Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dan Carpenter and committed by
Linus Torvalds
31279b14 2b37c7d8

+1
+1
drivers/block/aoe/aoedev.c
··· 461 461 d->targets = kcalloc(NTARGETS, sizeof(*d->targets), GFP_ATOMIC); 462 462 if (!d->targets) { 463 463 kfree(d); 464 + d = NULL; 464 465 goto out; 465 466 } 466 467 d->ntargets = NTARGETS;