linux/drivers/mtd/ubi
Zhihao Cheng 8c03a1c21d ubi: ubi_create_volume: Fix use-after-free when volume creation failed
There is an use-after-free problem for 'eba_tbl' in ubi_create_volume()'s
error handling path:

  ubi_eba_replace_table(vol, eba_tbl)
    vol->eba_tbl = tbl
out_mapping:
  ubi_eba_destroy_table(eba_tbl)   // Free 'eba_tbl'
out_unlock:
  put_device(&vol->dev)
    vol_release
      kfree(tbl->entries)	  // UAF

Fix it by removing redundant 'eba_tbl' releasing.
Fetch a reproducer in [Link].

Fixes: 493cfaeaa0 ("mtd: utilize new cdev_device_add helper function")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215965
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
2022-05-27 16:49:41 +02:00
..
attach.c mtd: Convert fallthrough comments into statements 2020-03-30 10:14:54 +02:00
block.c block: remove GENHD_FL_EXT_DEVT 2021-11-29 06:38:35 -07:00
build.c ubi: Fix race condition between ctrl_cdev_ioctl and ubi_cdev_ioctl 2022-01-09 21:13:28 +01:00
cdev.c compat_ioctl: move drivers to compat_ptr_ioctl 2019-10-23 17:23:43 +02:00
debug.c ubi: Fix a mistake in comment 2021-12-23 20:23:40 +01:00
debug.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
eba.c ubi: eba: Delete useless kfree code 2021-02-12 21:53:22 +01:00
fastmap-wl.c ubi: fastmap: Check wl_pool for free peb before wear leveling 2022-05-27 16:49:07 +02:00
fastmap.c ubi: fastmap: Fix high cpu usage of ubi_bgt by making sure wl_pool not empty 2022-05-27 16:46:02 +02:00
gluebi.c mtd: ubi: gluebi: Fix misnamed function parameter documentation 2020-11-20 12:37:32 +01:00
io.c ubi: remove dead code in validate_vid_hdr() 2021-02-12 21:53:22 +01:00
kapi.c mtd: ubi: kapi: Correct documentation for 'ubi_leb_read_sg's 'sgl' parameter 2020-11-20 12:37:31 +01:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile
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 ubi: fastmap: Fix high cpu usage of ubi_bgt by making sure wl_pool not empty 2022-05-27 16:46:02 +02:00
upd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
vmt.c ubi: ubi_create_volume: Fix use-after-free when volume creation failed 2022-05-27 16:49:41 +02: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: Check wl_pool for free peb before wear leveling 2022-05-27 16:49:07 +02:00
wl.h ubi: fastmap: Check wl_pool for free peb before wear leveling 2022-05-27 16:49:07 +02:00