]> git.proxmox.com Git - mirror_ubuntu-focal-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)
committerPaolo Pisati <paolo.pisati@canonical.com>
Mon, 17 Feb 2020 11:07:04 +0000 (12:07 +0100)
commit631f429d3bd04b2c6e90d815eb9567ca7f63ddff
tree50f769631f9dc8f30d925c70046e9a8e33abf36f
parent1a28d5f809cc581d34db826099691b7a252508db
ubi: Fix an error pointer dereference in error handling code

BugLink: https://bugs.launchpad.net/bugs/1863588
commit 5d3805af279c93ef49a64701f35254676d709622 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/mtd/ubi/fastmap.c