diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2022-05-20 18:41:40 +0200 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2022-06-06 14:58:26 +0200 |
commit | ec0da06337751b18f6dee06b6526e0f0d6e80369 (patch) | |
tree | bf0c9cced4911007cc45d5bd050e67cc3d9a52e3 /drivers/mtd/nand/raw/meson_nand.c | |
parent | 18178e03b124b0c6be17abbbca914157642f5d7a (diff) | |
download | linux-ec0da06337751b18f6dee06b6526e0f0d6e80369.tar.bz2 |
mtd: rawnand: meson: Fix a potential double free issue
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: 8fae856c5350 ("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
Diffstat (limited to 'drivers/mtd/nand/raw/meson_nand.c')
-rw-r--r-- | drivers/mtd/nand/raw/meson_nand.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index ac3be92872d0..032180183339 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -1307,7 +1307,6 @@ static int meson_nfc_nand_chip_cleanup(struct meson_nfc *nfc) if (ret) return ret; - meson_nfc_free_buffer(&meson_chip->nand); nand_cleanup(&meson_chip->nand); list_del(&meson_chip->node); } |