linux-stable/drivers/mtd/nand
Xin Xiong fe0e2ce5c8 mtd: rawnand: atmel: fix refcount issue in atmel_nand_controller_init
[ Upstream commit fecbd4a317 ]

The reference counting issue happens in several error handling paths
on a refcounted object "nc->dmac". In these paths, the function simply
returns the error code, forgetting to balance the reference count of
"nc->dmac", increased earlier by dma_request_channel(), which may
cause refcount leaks.

Fix it by decrementing the refcount of specific object in those error
paths.

Fixes: f88fc122cc ("mtd: nand: Cleanup/rework the atmel_nand driver")
Co-developed-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Co-developed-by: Xin Tan <tanxin.ctf@gmail.com>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Signed-off-by: Xin Xiong <xiongx18@fudan.edu.cn>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220304085330.3610-1-xiongx18@fudan.edu.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08 14:23:39 +02:00
..
onenand mtd: onenand: Check for error irq 2022-04-08 14:23:25 +02:00
raw mtd: rawnand: atmel: fix refcount issue in atmel_nand_controller_init 2022-04-08 14:23:39 +02:00
spi mtd: spinand: macronix: Add Quad support for serial NAND flash 2021-08-17 10:42:00 +02:00
bbt.c mtd: nand: bbt: Fix corner case in bad block table handling 2021-05-10 18:20:54 +02:00
core.c mtd: nand: Add helpers to manage ECC engines and configurations 2020-12-10 22:37:30 +01:00
ecc-sw-bch.c mtd: nand: ecc-bch: Use the public nsteps field 2021-03-11 09:37:28 +01:00
ecc-sw-hamming.c mtd: nand: ecc-hamming: Use the public nsteps field 2021-03-11 09:37:28 +01:00
ecc.c mtd: spinand: Allow the case where there is no ECC engine 2020-12-10 22:37:30 +01:00
Kconfig mtd: nand: Change dependency between the NAND and ECC cores 2020-12-10 22:37:32 +01:00
Makefile mtd: nand: ecc-hamming: Move Hamming code to the generic NAND layer 2020-12-10 22:37:29 +01:00