Thread (82 messages) 82 messages, 3 authors, 2012-01-05

[65/67] mfd: Check for twl4030-madc NULL pointer

From: Greg KH <gregkh@suse.de>
Date: 2012-01-03 22:38:06
Also in: lkml

3.0-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Kyle Manna <redacted>

commit d0e84caeb4cd535923884735906e5730329505b4 upstream.

If the twl4030-madc device wasn't registered, and another device, such
as twl4030-madc-hwmon, calls twl4030_madc_conversion() a NULL pointer is
dereferenced.

Signed-off-by: Kyle Manna <redacted>
Signed-off-by: Samuel Ortiz <redacted>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/mfd/twl4030-madc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/mfd/twl4030-madc.c
+++ b/drivers/mfd/twl4030-madc.c
@@ -510,8 +510,9 @@ int twl4030_madc_conversion(struct twl40
 	u8 ch_msb, ch_lsb;
 	int ret;
 
-	if (!req)
+	if (!req || !twl4030_madc)
 		return -EINVAL;
+
 	mutex_lock(&twl4030_madc->lock);
 	if (req->method < TWL4030_MADC_RT || req->method > TWL4030_MADC_SW2) {
 		ret = -EINVAL;

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help