Skip to content

Commit

Permalink
mtd: Blackfin NFC: fix invalid free in remove()
Browse files Browse the repository at this point in the history
Since info->mtd isn't dynamically allocated, we shouldn't attempt to
kfree() it.  Otherwise we get random fun corruption when unloading
the driver built as a module.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Mike Frysinger authored and David Woodhouse committed Sep 13, 2010
1 parent eac15a4 commit 8b865d5
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/mtd/nand/bf5xx_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,19 +682,14 @@ static int __devinit bf5xx_nand_add_partition(struct bf5xx_nand_info *info)
static int __devexit bf5xx_nand_remove(struct platform_device *pdev)
{
struct bf5xx_nand_info *info = to_nand_info(pdev);
struct mtd_info *mtd = NULL;

platform_set_drvdata(pdev, NULL);

/* first thing we need to do is release all our mtds
* and their partitions, then go through freeing the
* resources used
*/
mtd = &info->mtd;
if (mtd) {
nand_release(mtd);
kfree(mtd);
}
nand_release(&info->mtd);

peripheral_free_list(bfin_nfc_pin_req);
bf5xx_nand_dma_remove(info);
Expand Down

0 comments on commit 8b865d5

Please sign in to comment.