Skip to contentSkip to conversation

Fix incorrect structure freeing in omap_nand_remove()

PATCH New [email protected] 1 participant 1 message Apr 29, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix incorrect structure freeing in omap_nand_remove()

From: Oleg Drokin <[email protected]>

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.

---
 drivers/mtd/nand/omap2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/omap2.c +1 -1
index da9a351..39f5034 100644
@@ -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;
 }
 
Signature · 1 line
1.7.4.4