linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] mfd: vexpress: use after free in vexpress_syscfg_regmap_init()
@ 2014-06-11  6:07 Dan Carpenter
  2014-06-11  9:22 ` Pawel Moll
  0 siblings, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2014-06-11  6:07 UTC (permalink / raw)
  To: Arnd Bergmann, Pawel Moll, Lee Jones
  Cc: Greg Kroah-Hartman, Samuel Ortiz, linux-kernel, kernel-janitors

We should return NULL if regmap_init() fails instead of continuing.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/misc/vexpress-syscfg.c b/drivers/misc/vexpress-syscfg.c
index 73068e5..2c0ddb2 100644
--- a/drivers/misc/vexpress-syscfg.c
+++ b/drivers/misc/vexpress-syscfg.c
@@ -231,10 +231,12 @@ static struct regmap *vexpress_syscfg_regmap_init(struct device *dev,
 	func->regmap = regmap_init(dev, NULL, func,
 			&vexpress_syscfg_regmap_config);
 
-	if (IS_ERR(func->regmap))
+	if (IS_ERR(func->regmap)) {
 		kfree(func);
-	else
-		list_add(&func->list, &syscfg->funcs);
+		return NULL;
+	}
+
+	list_add(&func->list, &syscfg->funcs);
 
 	return func->regmap;
 }

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

end of thread, other threads:[~2014-06-13 14:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-11  6:07 [patch] mfd: vexpress: use after free in vexpress_syscfg_regmap_init() Dan Carpenter
2014-06-11  9:22 ` Pawel Moll
2014-06-11 10:07   ` Dan Carpenter
2014-06-11 10:17   ` [patch v2] mfd: vexpress: fix error handling vexpress_syscfg_regmap_init() Dan Carpenter
2014-06-11 10:33     ` Pawel Moll
2014-06-11 17:12       ` Greg Kroah-Hartman
2014-06-11 17:11         ` Pawel Moll
2014-06-13 14:02       ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).