[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <201110141800.29440.heiko@sntech.de>
Date: Fri, 14 Oct 2011 18:00:29 +0200
From: Heiko Stübner <heiko@...ech.de>
To: Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Liam Girdwood <lrg@...com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Heiko Stübner <heiko@...ech.de>
Subject: [PATCH RESEND] 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 <heiko@...ech.de>
Acked-by: Mark Brown <broonie@...nsource.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists