[PATCH v4] mtd: rawnand: atmel: fix refcount issue in atmel_nand_controller_init

Miquel Raynal miquel.raynal at bootlin.com
Mon Mar 14 09:00:00 PDT 2022


On Fri, 2022-03-04 at 08:53:32 UTC, Xin Xiong wrote:
> 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: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> Co-developed-by: Xiyu Yang <xiyuyang19 at fudan.edu.cn>
> Signed-off-by: Xiyu Yang <xiyuyang19 at fudan.edu.cn>
> Co-developed-by: Xin Tan <tanxin.ctf at gmail.com>
> Signed-off-by: Xin Tan <tanxin.ctf at gmail.com>
> Signed-off-by: Xin Xiong <xiongx18 at fudan.edu.cn>
> Reviewed-by: Claudiu Beznea <claudiu.beznea at microchip.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel



More information about the linux-mtd mailing list