linux/drivers/mtd
Lv Yunlong ef8e7bfea9 mtd: rawnand: gpmi: Fix a double free in gpmi_nand_init
[ Upstream commit 076de75de1e53160e9b099f75872c1f9adf41a0b ]

If the callee gpmi_alloc_dma_buffer() failed to alloc memory for
this->raw_buffer, gpmi_free_dma_buffer() will be called to free
this->auxiliary_virt. But this->auxiliary_virt is still a non-NULL
and valid ptr.

Then gpmi_alloc_dma_buffer() returns err and gpmi_free_dma_buffer()
is called again to free this->auxiliary_virt in err_out. This causes
a double free.

As gpmi_free_dma_buffer() has already called in gpmi_alloc_dma_buffer's
error path, so it should return err directly instead of releasing the dma
buffer again.

Fixes: 4d02423e9a ("mtd: nand: gpmi: Fix gpmi_nand_init() error path")
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210403060905.5251-1-lyl2019@mail.ustc.edu.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-14 09:44:20 +02:00
..
chips mtd: cfi_cmdset_0002: don't free cfi->cfiq in error path of cfi_amdstd_setup() 2020-10-01 13:17:16 +02:00
devices
hyperbus
lpddr mtd: lpddr: fix excessive stack usage with clang 2020-10-29 09:57:46 +01:00
maps
nand mtd: rawnand: gpmi: Fix a double free in gpmi_nand_init 2021-05-14 09:44:20 +02:00
parsers mtd: parsers: afs: Fix freeing the part name memory in failure 2021-03-04 10:26:24 +01:00
spi-nor mtd: spi-nor: hisi-sfc: Put child node np on error path 2021-03-04 10:26:48 +01:00
tests
ubi ubi: check kthread_should_stop() after the setting of task state 2020-11-05 11:43:33 +01:00
Kconfig
Makefile
ftl.c
inftlcore.c
inftlmount.c
mtd_blkdevs.c
mtdblock.c
mtdblock_ro.c
mtdchar.c mtd: require write permissions for locking and badblock ioctls 2021-05-14 09:44:19 +02:00
mtdconcat.c
mtdcore.c mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions() 2021-05-14 09:44:17 +02:00
mtdcore.h
mtdoops.c mtd: mtdoops: Don't write panic data twice 2020-10-29 09:57:47 +01:00
mtdpart.c
mtdsuper.c
mtdswap.c
nftlcore.c
nftlmount.c
rfd_ftl.c
sm_ftl.c
sm_ftl.h
ssfdc.c