]> git.baikalelectronics.ru Git - kernel.git/commit
opp: core: Check for pending links before reading required_opp pointers
authorMarijn Suijten <marijn.suijten@somainline.org>
Sun, 22 Aug 2021 17:44:10 +0000 (19:44 +0200)
committerViresh Kumar <viresh.kumar@linaro.org>
Mon, 23 Aug 2021 07:14:55 +0000 (12:44 +0530)
commit501fbadb5cb33ea7d7ecbc9374f97049f5d1184d
treef9e4c3b59a4604305d3526bc25c3308af369f8a9
parente39d9a3f540359ab756e7bfb49962bcd4d9bb240
opp: core: Check for pending links before reading required_opp pointers

Commit 01ddb676a6d6 ("opp: Allow required-opps to be used for non genpd
use cases") dereferences the pointers in required_opp_tables but these
might be set to an ERR_PTR if the list still has lazy links pending,
resulting in segfaults.  Prior to this patch IS_ERR was also checked on
required_opp_tables[i] before reading ->is_genpd inside
_opp_table_alloc_required_tables, which is at the same time the
predicate to add this table to the lazy list.  This segfault is solved
by reordering the checks to bail on lazy pending tables before reading
->is_genpd.

Fixes: 01ddb676a6d6 ("opp: Allow required-opps to be used for non genpd use cases")
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/opp/core.c