forked from luck/tmp_suning_uos_patched
mtd: nand: fix memory leak in ONFI extended parameter page
This fixes a memory leak in the ONFI support code for detecting the
required ECC levels from this commit:
commit 6dcbe0cdd8
Author: Huang Shijie <b32955@freescale.com>
Date: Wed May 22 10:28:27 2013 +0800
mtd: get the ECC info from the Extended Parameter Page
In the success case, we never freed the 'ep' buffer.
Also, this fixes an oversight in the same commit where we (harmlessly)
freed the NULL pointer.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
parent
7b9e3a6ac0
commit
5cb1327172
@ -2869,10 +2869,8 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd,
|
|||||||
|
|
||||||
len = le16_to_cpu(p->ext_param_page_length) * 16;
|
len = le16_to_cpu(p->ext_param_page_length) * 16;
|
||||||
ep = kmalloc(len, GFP_KERNEL);
|
ep = kmalloc(len, GFP_KERNEL);
|
||||||
if (!ep) {
|
if (!ep)
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto ext_out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Send our own NAND_CMD_PARAM. */
|
/* Send our own NAND_CMD_PARAM. */
|
||||||
chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1);
|
chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1);
|
||||||
@ -2920,7 +2918,7 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pr_info("ONFI extended param page detected.\n");
|
pr_info("ONFI extended param page detected.\n");
|
||||||
return 0;
|
ret = 0;
|
||||||
|
|
||||||
ext_out:
|
ext_out:
|
||||||
kfree(ep);
|
kfree(ep);
|
||||||
|
Loading…
Reference in New Issue
Block a user