diff mbox

Fix incorrect structure freeing in omap_nand_remove()

Message ID 1304103805-14057-1-git-send-email-green@linuxhacker.ru (mailing list archive)
State New, archived
Headers show

Commit Message

Oleg Drokin April 29, 2011, 7:03 p.m. UTC
From: Oleg Drokin <green@linuxhacker.ru>

Attempt to kfree(&info->mtd) is a bad idea since it's
a different substructure in the middle of a properly
allocated struct omap_nand_info.
I guess nobody tripped it before since nobody really
removes NAND flash and nobody unloads the module either.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
 drivers/mtd/nand/omap2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index da9a351..39f5034 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1139,7 +1139,7 @@  static int omap_nand_remove(struct platform_device *pdev)
 	/* Release NAND device, its internal structures and partitions */
 	nand_release(&info->mtd);
 	iounmap(info->nand.IO_ADDR_R);
-	kfree(&info->mtd);
+	kfree(info);
 	return 0;
 }