forked from luck/tmp_suning_uos_patched
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>
This commit is contained in:
parent
2b37c7d865
commit
31279b1457
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user