u-boot/drivers/mtd/spi
Boris Brezillon 7371944a71 mtd: sf: Unregister the MTD device prior to removing the spi_flash obj
The DM implementation of spi_flash_free() does not unregister the MTD
device before removing the spi dev object. This leads to a use-after-free
bug when the MTD device is later accessed by a MTD user (observed when
attaching the device to UBI after env_sf_load() has called
spi_flash_free()).

Implement ->remove() and call spi_flash_mtd_unregister() from there.

Fixes: 9fe6d8716e ("mtd, spi: Add MTD layer driver")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Jagan Teki <jagan@openedev.com>
2018-12-06 00:45:36 +05:30
..
fsl_espi_spl.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
Kconfig sf: Add XMC xm25qh64a and xm25qh128a entries 2018-10-04 18:21:23 +05:30
Makefile SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
sandbox.c dm: spi: Clean up detection of sandbox SPI emulator 2018-10-09 04:40:27 -06:00
sf_dataflash.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
sf_internal.h sf: Add MICRON manufacturer id 2018-10-12 11:37:49 +05:30
sf_mtd.c mtd: sf: Make sure we don't register the same device twice 2018-12-06 00:45:36 +05:30
sf_probe.c mtd: sf: Unregister the MTD device prior to removing the spi_flash obj 2018-12-06 00:45:36 +05:30
sf-uclass.c dm: spi: Add logging of some return values 2018-10-09 04:40:27 -06:00
sf.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
spi_flash_ids.c sf: Add XMC xm25qh64a and xm25qh128a entries 2018-10-04 18:21:23 +05:30
spi_flash.c Merge branch 'master' of git://git.denx.de/u-boot-spi 2018-10-12 11:54:13 -04:00