]> git.baikalelectronics.ru Git - kernel.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)
commitfe1bcf46cadfba3c16b834f0901c36b259d27541
treec7fc7a4ac832b81d5e76d360efd7b418d179323d
parent293b52f1388f9010212a45c8dc2fbc6b909ac680
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: 623ed1aa9404 ("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