Эх сурвалжийг харах

reset: NULL deref on allocation failure

"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>
Dan Carpenter 12 жил өмнө
parent
commit
6034bb22d8

+ 1 - 1
drivers/reset/core.c

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