]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: rawnand: meson: Fix a potential double free issue
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 20 May 2022 16:41:40 +0000 (18:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:38 +0000 (14:23 +0200)
commitdc6d4ae9e814807d388b92ddf26a193ff7b40b1b
treeae0172b74b5afe4120c6815f402bed7a72f354e6
parentcf9dba2504887dd155a79e8fdeba762445b65526
mtd: rawnand: meson: Fix a potential double free issue

[ Upstream commit 5e53443dc70aef3086f90a8223f04f1e6080bddb ]

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: a8b6ef1f6111 ("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>
drivers/mtd/nand/raw/meson_nand.c