diff options
author | Zhihao Cheng <chengzhihao1@huawei.com> | 2020-07-07 15:41:01 +0200 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2020-08-02 23:56:13 +0200 |
commit | c3fc1a3919e35a9d8157ed3ae6fd0a478293ba2c (patch) | |
tree | 5e79c3113b3cd452d8491859a27d8d3349adcf71 /drivers/mtd/ubi | |
parent | ubi: fastmap: Don't produce the initial next anchor PEB when fastmap is disabled (diff) | |
download | linux-c3fc1a3919e35a9d8157ed3ae6fd0a478293ba2c.tar.xz linux-c3fc1a3919e35a9d8157ed3ae6fd0a478293ba2c.zip |
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 <chengzhihao1@huawei.com>
Fixes: 4b68bf9a69d22d ("ubi: Select fastmap anchor PEBs considering...")
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r-- | drivers/mtd/ubi/fastmap-wl.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/fastmap-wl.c b/drivers/mtd/ubi/fastmap-wl.c index 83afc00e365a..28f55f9cf715 100644 --- a/drivers/mtd/ubi/fastmap-wl.c +++ b/drivers/mtd/ubi/fastmap-wl.c @@ -381,6 +381,11 @@ static void ubi_fastmap_close(struct ubi_device *ubi) 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) { for (i = 0; i < ubi->fm->used_blocks; i++) kfree(ubi->fm->e[i]); |