linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] aoe: use after free in aoedev_by_aoeaddr()
@ 2012-12-07  6:19 Dan Carpenter
  2012-12-07 13:20 ` Ed Cashin
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2012-12-07  6:19 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, kernel-janitors

We should return NULL on failure instead of returning a freed pointer.

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

diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
index e66ccbf..98f2965 100644
--- a/drivers/block/aoe/aoedev.c
+++ b/drivers/block/aoe/aoedev.c
@@ -461,6 +461,7 @@ aoedev_by_aoeaddr(ulong maj, int min, int do_alloc)
 	d->targets = kcalloc(NTARGETS, sizeof(*d->targets), GFP_ATOMIC);
 	if (!d->targets) {
 		kfree(d);
+		d = NULL;
 		goto out;
 	}
 	d->ntargets = NTARGETS;

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

end of thread, other threads:[~2012-12-10  8:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-07  6:19 [patch] aoe: use after free in aoedev_by_aoeaddr() Dan Carpenter
2012-12-07 13:20 ` Ed Cashin
2012-12-10  8:59   ` Dan Carpenter

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).