]> asedeno.scripts.mit.edu Git - linux.git/commit
ubi: Fix an error pointer dereference in error handling code
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 13 Jan 2020 13:23:46 +0000 (16:23 +0300)
committerRichard Weinberger <richard@nod.at>
Sun, 19 Jan 2020 22:23:28 +0000 (23:23 +0100)
commit5d3805af279c93ef49a64701f35254676d709622
treec7fc7a4ac832b81d5e76d360efd7b418d179323d
parentff90bdfb206e49c8b418811efbdd0c77380fa8c2
ubi: Fix an error pointer dereference in error handling code

If "seen_pebs = init_seen(ubi);" fails then "seen_pebs" is an error pointer
and we try to kfree() it which results in an Oops.

This patch re-arranges the error handling so now it only frees things
which have been allocated successfully.

Fixes: daef3dd1f0ae ("UBI: Fastmap: Add self check to detect absent PEBs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/fastmap.c