linux/drivers/mtd/devices
James Kim ca19808bc6 mtd: docg3: fix use-after-free in docg3_release()
In docg3_release(), the docg3 pointer is obtained from
cascade->floors[0]->priv before the loop that calls
doc_release_device() on each floor. doc_release_device() frees the
docg3 struct via kfree(docg3) at line 1881. After the loop,
docg3->cascade->bch dereferences the already-freed pointer.

Fix this by accessing cascade->bch directly, which is equivalent
since docg3->cascade points back to the same cascade struct, and
is already available as a local variable. This also removes the
now-unused docg3 local variable.

Fixes: c8ae3f744d ("lib/bch: Rework a little bit the exported function names")
Cc: stable@vger.kernel.org
Signed-off-by: James Kim <james010kim@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2026-03-11 16:24:10 +01:00
..
bcm47xxsflash.c mtd: Switch back to struct platform_driver::remove() 2024-10-21 11:58:07 +02:00
bcm47xxsflash.h
block2mtd.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
docg3.c mtd: docg3: fix use-after-free in docg3_release() 2026-03-11 16:24:10 +01:00
docg3.h mtd: docg3: fix kernel-doc warnings 2025-11-29 13:49:58 +01:00
Kconfig mtd: MTD_INTEL_DG should depend on DRM_I915 or DRM_XE 2025-08-28 14:22:48 +02:00
Makefile mtd: add driver for intel graphics non-volatile memory device 2025-06-23 13:14:49 -04:00
mchp23k256.c mtd: mchp23k256: drop unneeded MODULE_ALIAS 2024-04-15 12:06:06 +02:00
mchp48l640.c mtd: mchp48l640: Use str_enable_disable() in mchp48l640_write_prepare() 2025-03-18 17:18:51 +01:00
ms02-nv.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ms02-nv.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
mtd_dataflash.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mtd_intel_dg.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mtdram.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
phram.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pmc551.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
powernv_flash.c mtd: Switch back to struct platform_driver::remove() 2024-10-21 11:58:07 +02:00
serial_flash_cmds.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 420 2019-06-05 17:37:15 +02:00
slram.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spear_smi.c mtd: Switch back to struct platform_driver::remove() 2024-10-21 11:58:07 +02:00
sst25l.c spi: make remove callback a void function 2022-02-09 13:00:45 +00:00
st_spi_fsm.c mtd: st_spi_fsm: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() 2025-01-15 19:10:29 +01:00