mirror_ubuntu-kernels/drivers/mtd/nand/raw/gpmi-nand
Lv Yunlong 076de75de1 mtd: rawnand: gpmi: Fix a double free in gpmi_nand_init
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
2021-04-07 10:07:32 +02:00
..
bch-regs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 1 2019-05-21 11:28:39 +02:00
gpmi-nand.c mtd: rawnand: gpmi: Fix a double free in gpmi_nand_init 2021-04-07 10:07:32 +02:00
gpmi-nand.h mtd: rawnand: gpmi: Implement exec_op 2019-06-27 20:05:30 +02:00
gpmi-regs.h mtd: rawnand: gpmi: Fix the driver only sense CS0 R/B issue 2020-12-10 22:37:33 +01:00
Makefile mtd: rawnand: gpmi: cleanup makefile 2020-12-10 22:37:31 +01:00