WSL2-Linux-Kernel/drivers/mtd/devices
H Hartley Sweeten d4702669b0 mtd: fix memory leak in mtd_dataflash
Fix a potential memory leak in mtd_dataflash driver.

The private data that is allocated when registering a DataFlash
device with the MTD subsystem is not released if an error occurs
when add_mtd_partitions() or add_mtd_device() is called.  Fix this
by adding an error path.  The memory is already released during a
remove.

Also, add a dev_set_drvdata(&spi->dev, NULL) before the kfree() so
that the spi device does not reference invalid data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-10-17 15:41:11 +01:00
..
Kconfig mtd: SST25L (non JEDEC) SPI Flash driver 2009-09-19 10:54:45 -07:00
Makefile mtd: SST25L (non JEDEC) SPI Flash driver 2009-09-19 10:54:45 -07:00
block2mtd.c [PATCH] propagate mode through open_bdev_excl/close_bdev_excl 2008-10-21 07:49:00 -04:00
doc2000.c [MTD] we don't need no misc devices 2009-03-20 13:16:26 +00:00
doc2001.c [MTD] we don't need no misc devices 2009-03-20 13:16:26 +00:00
doc2001plus.c [MTD] we don't need no misc devices 2009-03-20 13:16:26 +00:00
docecc.c [MTD] we don't need no misc devices 2009-03-20 13:16:26 +00:00
docprobe.c [MTD] [NAND] remove __PPC__ hardcoded address from DiskOnChip drivers 2008-07-11 18:21:54 +01:00
lart.c mtd: lart: Prevent a read from mtd->eraseregions[-1] 2009-09-19 11:18:15 -07:00
m25p80.c mtd: m25p80: disable SST software protection bits by default 2009-09-24 12:52:29 -07:00
ms02-nv.c MTD/JFFS2: remove CVS keywords 2008-06-04 17:50:17 +01:00
ms02-nv.h MTD/JFFS2: remove CVS keywords 2008-06-04 17:50:17 +01:00
mtd_dataflash.c mtd: fix memory leak in mtd_dataflash 2009-10-17 15:41:11 +01:00
mtdram.c NOMMU: Present backing device capabilities for MTD chardevs 2009-03-24 09:00:19 +00:00
phram.c phram: cleanup error handling and associated messages 2009-09-19 13:11:12 -07:00
pmc551.c trivial: fix then -> than typos in comments and documentation 2009-01-06 11:28:06 +01:00
slram.c Merge git://git.infradead.org/mtd-2.6 2009-09-23 10:07:49 -07:00
sst25l.c mtd: sst25l, fix lock imbalance 2009-09-19 10:56:53 -07:00