From 31279b1457f992f24eee8d45ddd647f5fce42cf6 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 17 Dec 2012 16:04:21 -0800 Subject: aoe: fix use after free in aoedev_by_aoeaddr() We should return NULL on failure instead of returning a freed pointer. Signed-off-by: Dan Carpenter Cc: Ed Cashin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/block/aoe/aoedev.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/block/aoe') diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c index e66ccbf41a50..98f2965778b9 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; -- cgit v1.2.1