aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-12-17 19:04:21 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-17 20:15:26 -0500
commit31279b1457f992f24eee8d45ddd647f5fce42cf6 (patch)
tree25e8286f5e1fc6e01219eac7452b043a62aae90e /drivers/block
parent2b37c7d865121249f2dee9ae25d524333b07be63 (diff)
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 <dan.carpenter@oracle.com> Cc: Ed Cashin <ecashin@coraid.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/aoe/aoedev.c1
1 files changed, 1 insertions, 0 deletions
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)
461 d->targets = kcalloc(NTARGETS, sizeof(*d->targets), GFP_ATOMIC); 461 d->targets = kcalloc(NTARGETS, sizeof(*d->targets), GFP_ATOMIC);
462 if (!d->targets) { 462 if (!d->targets) {
463 kfree(d); 463 kfree(d);
464 d = NULL;
464 goto out; 465 goto out;
465 } 466 }
466 d->ntargets = NTARGETS; 467 d->ntargets = NTARGETS;