Skip to content

Commit c3fc1a3

Browse files
Zhihao Chengrichardweinberger
authored andcommitted
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: Zhihao Cheng <[email protected]> Fixes: 4b68bf9 ("ubi: Select fastmap anchor PEBs considering...") Signed-off-by: Richard Weinberger <[email protected]>
1 parent 3b18525 commit c3fc1a3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/mtd/ubi/fastmap-wl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,11 @@ static void ubi_fastmap_close(struct ubi_device *ubi)
381381
ubi->fm_anchor = NULL;
382382
}
383383

384+
if (ubi->fm_next_anchor) {
385+
return_unused_peb(ubi, ubi->fm_next_anchor);
386+
ubi->fm_next_anchor = NULL;
387+
}
388+
384389
if (ubi->fm) {
385390
for (i = 0; i < ubi->fm->used_blocks; i++)
386391
kfree(ubi->fm->e[i]);

0 commit comments

Comments
 (0)