regulator: Fix possible nullpointer dereference in regulator_enable()
PATCH RESEND 1/1 regulator: Fix possible nullpointer dereference in regulator_enable()
In the case where _regulator_enable returns an error it was not checked if a supplying regulator exists before trying to disable it, leading to a null pointer-dereference if no supplying regulator existed.
Signed-off-by Heiko Stuebner <[email protected]>
Acked-by Mark Brown <[email protected]>
---
no changes, except adding the ack from Mark Brown from 2011-09-19 and including the relevant (and forgotten in the first try) LKML
drivers/regulator/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/core.c +1 -1
@@ -1425,7 +1425,7 @@ int regulator_enable(struct regulator *regulator) ret =_regulator_enable (rdev);mutex_unlock (&rdev->mutex); -if (ret !=0 ) +if (ret !=0 && rdev->supply)regulator_disable (rdev->supply);return ret;
Signature · 1 line
1.7.2.3
Mark Brown
AppliedQuoted 3 lines · Heiko Stübner
In the case where
_regulator_enablereturns an error it was not checked if a supplying regulator exists before trying to disable it, leading to a null pointer-dereference if no supplying regulator existed.
Applied, thanks.