]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ubi: fastmap: Free unused fastmap anchor peb during detach
authorHou Tao <houtao1@huawei.com>
Mon, 10 Feb 2020 13:26:34 +0000 (21:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Apr 2020 11:18:06 +0000 (13:18 +0200)
commit4dd5b930ff18a10532b16c38b2e18797a28fb549
tree9994fd32fafb7b8e313b091ef6835b97ce1e8701
parent95c6f33c4e66b8d5607e562885a28e1b729a5e6b
ubi: fastmap: Free unused fastmap anchor peb during detach

commit c16f39d14a7e0ec59881fbdb22ae494907534384 upstream.

When CONFIG_MTD_UBI_FASTMAP is enabled, fm_anchor will be assigned
a free PEB during ubi_wl_init() or ubi_update_fastmap(). However
if fastmap is not used or disabled on the MTD device, ubi_wl_entry
related with the PEB will not be freed during detach.

So Fix it by freeing the unused fastmap anchor during detach.

Fixes: f9c34bb52997 ("ubi: Fix producing anchor PEBs")
Reported-by: syzbot+f317896aae32eb281a58@syzkaller.appspotmail.com
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/ubi/fastmap-wl.c