Commit c3fc1a39 authored by Zhihao Cheng's avatar Zhihao Cheng Committed by Richard Weinberger

ubi: fastmap: Free fastmap next anchor peb during detach

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: default avatarZhihao Cheng <chengzhihao1@huawei.com>
Fixes: 4b68bf9a ("ubi: Select fastmap anchor PEBs considering...")
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 3b185255
...@@ -381,6 +381,11 @@ static void ubi_fastmap_close(struct ubi_device *ubi) ...@@ -381,6 +381,11 @@ static void ubi_fastmap_close(struct ubi_device *ubi)
ubi->fm_anchor = NULL; ubi->fm_anchor = NULL;
} }
if (ubi->fm_next_anchor) {
return_unused_peb(ubi, ubi->fm_next_anchor);
ubi->fm_next_anchor = NULL;
}
if (ubi->fm) { if (ubi->fm) {
for (i = 0; i < ubi->fm->used_blocks; i++) for (i = 0; i < ubi->fm->used_blocks; i++)
kfree(ubi->fm->e[i]); kfree(ubi->fm->e[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment