ubi: fastmap: Free fastmap next anchor peb during detach
authorZhihao Cheng <chengzhihao1@huawei.com>
Tue, 7 Jul 2020 13:41:01 +0000 (21:41 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 11:15:13 +0000 (13:15 +0200)
commit9a51a86041f798181f1470d32a0f17e13e977fe5
treeea8a4f756d86e99ccedc07425d8fb6bae5dd3516
parenta62f895d09f3ef640d14f98aa33bf9785ed8d7c4
ubi: fastmap: Free fastmap next anchor peb during detach

[ Upstream commit c3fc1a3919e35a9d8157ed3ae6fd0a478293ba2c ]

ubi_wl_entry related with the fm_next_anchor PEB is not freed during
detach, which causes a memory leak.
Don't forget to release fm_next_anchor PEB while detaching ubi from
mtd when CONFIG_MTD_UBI_FASTMAP is enabled.

Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Fixes: 4b68bf9a69d22d ("ubi: Select fastmap anchor PEBs considering...")
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mtd/ubi/fastmap-wl.c