Skip to contentSkip to conversation

PM / OPP: Fix NULL pointer dereference when no regulator is defined

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 2 messages Feb 11, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM / OPP: Fix NULL pointer dereference when no regulator is defined

Commit 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't supported by the regulator") causes NULL pointer dereference OOPS when no regulator for OPP is defined. Fix it by replacing IS_ERR() check with IS_ERR_OR_NULL() one (since providing regulator for OPP is optional).

Cc Viresh Kumar <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Fixes 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't supported by the regulator")

---
This fixes linux-pm/linux-next tree boot hang regression on Exynos4412 SoC based Odroid-U3 board.

Rafael, please apply. Thank you!

 drivers/base/power/opp/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/opp/core.c +1 -1
index ab711c2..d7cd4e2 100644
@@ -975,7 +975,7 @@ static bool _opp_supported_by_regulators(struct dev_pm_opp *opp,
 {
 	struct regulator *reg = dev_opp->regulator;
 
-	if (!IS_ERR(reg) &&
+	if (!IS_ERR_OR_NULL(reg) &&
 	    !regulator_is_supported_voltage(reg, opp->u_volt_min,
 					    opp->u_volt_max)) {
 		pr_warn("%s: OPP minuV: %lu maxuV: %lu, not supported by regulator\n",
Signature · 1 line
1.9.1
#1 lore raw
Quoted 11 lines · Bartlomiej Zolnierkiewicz

Commit 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't supported by the regulator") causes NULL pointer dereference OOPS when no regulator for OPP is defined. Fix it by replacing IS_ERR() check with IS_ERR_OR_NULL() one (since providing regulator for OPP is optional).

Cc Viresh Kumar <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Fixes 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't supported by the regulator")
Quoted 5 lines

---
This fixes linux-pm/linux-next tree boot hang regression on Exynos4412 SoC based Odroid-U3 board.

Rafael, please apply. Thank you!

This has been fixed by an identical patch from Jon Hunter I received earlier.

Thanks,
Rafael