Skip to content

Commit 2399401

Browse files
Zheng Yongjunmiquelraynal
authored andcommitted
mtd: maps: pxa2xx-flash: fix memory leak in probe
Free 'info' upon remapping error to avoid a memory leak. Fixes: e644f7d ("[MTD] MAPS: Merge Lubbock and Mainstone drivers into common PXA2xx driver") Signed-off-by: Zheng Yongjun <[email protected]> [<[email protected]>: Reword the commit log] Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 56570bd commit 2399401

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/mtd/maps/pxa2xx-flash.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
6464
if (!info->map.virt) {
6565
printk(KERN_WARNING "Failed to ioremap %s\n",
6666
info->map.name);
67+
kfree(info);
6768
return -ENOMEM;
6869
}
6970
info->map.cached = ioremap_cache(info->map.phys, info->map.size);
@@ -85,6 +86,7 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
8586
iounmap((void *)info->map.virt);
8687
if (info->map.cached)
8788
iounmap(info->map.cached);
89+
kfree(info);
8890
return -EIO;
8991
}
9092
info->mtd->dev.parent = &pdev->dev;

0 commit comments

Comments
 (0)