1
0
Fork 0
freescale-linux-fslc/drivers/mtd/nand
Lv Yunlong b1d1f644ed mtd: rawnand: gpmi: Fix a double free in gpmi_nand_init
[ Upstream commit 076de75de1 ]

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:50:15 +02:00
..
onenand mtd: onenand: simplify the return expression of onenand_transfer_auto_oob 2020-09-30 16:44:17 +02:00
raw mtd: rawnand: gpmi: Fix a double free in gpmi_nand_init 2021-05-14 09:50:15 +02:00
spi mtd: spinand: core: add missing MODULE_DEVICE_TABLE() 2021-05-11 14:47:13 +02:00
Kconfig mtd: nand: Introduce the ECC engine framework 2020-09-02 09:28:15 +02:00
Makefile mtd: nand: Introduce the ECC engine framework 2020-09-02 09:28:15 +02:00
bbt.c mtd: nand: Fix memory allocation in nanddev_bbt_init() 2018-11-28 15:41:50 +01:00
core.c mtd: nand: Add max_bad_eraseblocks_per_lun info to memorg 2019-04-08 10:21:08 +02:00
ecc.c mtd: nand: Introduce the ECC engine framework 2020-09-02 09:28:15 +02:00