linux-stable/drivers/mtd/ubi
Zhihao Cheng 3b185255bb ubi: fastmap: Don't produce the initial next anchor PEB when fastmap is disabled
Following process triggers a memleak caused by forgetting to release the
initial next anchor PEB (CONFIG_MTD_UBI_FASTMAP is disabled):
1. attach -> __erase_worker -> produce the initial next anchor PEB
2. detach -> ubi_fastmap_close (Do nothing, it should have released the
   initial next anchor PEB)

Don't produce the initial next anchor PEB in __erase_worker() when fastmap
is disabled.

Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Suggested-by: Sascha Hauer <s.hauer@pengutronix.de>
Fixes: f9c34bb529 ("ubi: Fix producing anchor PEBs")
Reported-by: syzbot+d9aab50b1154e3d163f5@syzkaller.appspotmail.com
Signed-off-by: Richard Weinberger <richard@nod.at>
2020-08-02 23:56:13 +02:00
..
attach.c mtd: Convert fallthrough comments into statements 2020-03-30 10:14:54 +02:00
block.c ubi: block: Warn if volume size is not multiple of 512 2019-09-15 22:12:49 +02:00
build.c ubi: Relax the 'no MLC' rule and allow MLCs operating in SLC mode 2020-05-11 09:51:42 +02:00
cdev.c compat_ioctl: move drivers to compat_ptr_ioctl 2019-10-23 17:23:43 +02:00
debug.c ubi: Fix seq_file usage in detailed_erase_block_info debugfs file 2020-05-17 23:38:21 +02:00
debug.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
eba.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
fastmap-wl.c ubi: Select fastmap anchor PEBs considering wear level rules 2020-06-02 22:53:05 +02:00
fastmap.c ubi: Select fastmap anchor PEBs considering wear level rules 2020-06-02 22:53:05 +02:00
gluebi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
io.c mm: remove the pgprot argument to __vmalloc 2020-06-02 10:59:11 -07:00
kapi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
misc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
ubi-media.h ubi: ubi-media.h: Replace zero-length array with flexible-array member 2020-03-30 23:02:37 +02:00
ubi.h This pull request contains a single change for UBI: 2020-06-10 13:24:40 -07:00
upd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
vmt.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
vtbl.c ubi: Free the normal volumes in error paths of ubi_attach_mtd_dev() 2020-01-16 23:35:59 +01:00
wl.c ubi: fastmap: Don't produce the initial next anchor PEB when fastmap is disabled 2020-08-02 23:56:13 +02:00
wl.h ubi: Fix producing anchor PEBs 2019-11-17 22:45:57 +01:00