public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] regulator: Fix possible nullpointer dereference in regulator_enable()
@ 2011-10-14 16:00 Heiko Stübner
  2011-10-14 19:47 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Heiko Stübner @ 2011-10-14 16:00 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: LKML, Heiko Stübner

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 <heiko@sntech.de>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

---
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(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 026f3d4..c9dd19c 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -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;
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND] regulator: Fix possible nullpointer dereference in regulator_enable()
  2011-10-14 16:00 [PATCH RESEND] regulator: Fix possible nullpointer dereference in regulator_enable() Heiko Stübner
@ 2011-10-14 19:47 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2011-10-14 19:47 UTC (permalink / raw)
  To: Heiko Stübner; +Cc: Liam Girdwood, LKML

On Fri, Oct 14, 2011 at 06:00:29PM +0200, Heiko Stübner wrote:
> 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.

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-14 19:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-14 16:00 [PATCH RESEND] regulator: Fix possible nullpointer dereference in regulator_enable() Heiko Stübner
2011-10-14 19:47 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox