reset: NULL deref on allocation failure
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 3 Apr 2013 05:02:53 +0000 (08:02 +0300)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Fri, 12 Apr 2013 08:26:24 +0000 (10:26 +0200)
"rstc" is NULL here and we should use "rcdev" instead of "rstc->rcdev".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/reset/core.c

index a258277959b42886432b850ad1fc44fc8119c445..d1b6089a0ef82f57c9aece8b86168a336710b70d 100644 (file)
@@ -181,7 +181,7 @@ struct reset_control *reset_control_get(struct device *dev, const char *id)
 
        rstc = kzalloc(sizeof(*rstc), GFP_KERNEL);
        if (!rstc) {
-               module_put(rstc->rcdev->owner);
+               module_put(rcdev->owner);
                return ERR_PTR(-ENOMEM);
        }