Skip to content

Commit 098b7e8

Browse files
tititiou36gregkh
authored andcommitted
mtd: rawnand: meson: Fix a potential double free issue
[ Upstream commit ec0da06 ] When meson_nfc_nand_chip_cleanup() is called, it will call: meson_nfc_free_buffer(&meson_chip->nand); nand_cleanup(&meson_chip->nand); nand_cleanup() in turn will call nand_detach() which calls the .detach_chip() which is here meson_nand_detach_chip(). meson_nand_detach_chip() already calls meson_nfc_free_buffer(), so we could double free some memory. Fix it by removing the unneeded explicit call to meson_nfc_free_buffer(). Fixes: 8fae856 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Liang Yang <liang.yang@amlogic.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/ec15c358b8063f7c50ff4cd628cf0d2e14e43f49.1653064877.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d573078 commit 098b7e8

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

drivers/mtd/nand/raw/meson_nand.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,6 @@ static int meson_nfc_nand_chip_cleanup(struct meson_nfc *nfc)
13071307
if (ret)
13081308
return ret;
13091309

1310-
meson_nfc_free_buffer(&meson_chip->nand);
13111310
nand_cleanup(&meson_chip->nand);
13121311
list_del(&meson_chip->node);
13131312
}

0 commit comments

Comments
 (0)