Searched hist:"2233 bdccd1114bd16338848ba75026f572cbd191" (Results 1 – 1 of 1) sorted by relevance
| /rk3399_rockchip-uboot/drivers/mtd/spi/ |
| H A D | sf_probe.c | 2233bdccd1114bd16338848ba75026f572cbd191 Sun Dec 02 09:54:31 UTC 2018 Boris Brezillon <boris.brezillon@bootlin.com> UPSTREAM: 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: 9fe6d8716e09 ("mtd, spi: Add MTD layer driver") Change-Id: I2d825a7cc4ac5a6ce9cf17d59cfe3fbe4e120bd0 Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Tested-by: Heiko Schocher <hs@denx.de> Reviewed-by: Jagan Teki <jagan@openedev.com> Signed-off-by: Jon Lin <jon.lin@rock-chips.com> (cherry picked from commit 7371944a71690abafd0717b5d5f72c67e9f0f414)
|