base-files: define yes/no as valid boolean options
[openwrt/staging/mkresin.git] / target / linux / mvebu / patches-3.10 / 0095-mtd-nand-fix-memory-leak-in-ONFI-extended-parameter-.patch
1 From 5d15281ca712cb873835e301937f3a8342e88d4b Mon Sep 17 00:00:00 2001
2 From: Brian Norris <computersforpeace@gmail.com>
3 Date: Mon, 16 Sep 2013 17:59:20 -0700
4 Subject: [PATCH 095/203] mtd: nand: fix memory leak in ONFI extended parameter
5 page
6
7 This fixes a memory leak in the ONFI support code for detecting the
8 required ECC levels from this commit:
9
10 commit 6dcbe0cdd83fb5f77be4f44c9e06c535281c375a
11 Author: Huang Shijie <b32955@freescale.com>
12 Date: Wed May 22 10:28:27 2013 +0800
13
14 mtd: get the ECC info from the Extended Parameter Page
15
16 In the success case, we never freed the 'ep' buffer.
17
18 Also, this fixes an oversight in the same commit where we (harmlessly)
19 freed the NULL pointer.
20
21 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
22 Acked-by: Huang Shijie <b32955@freescale.com>
23 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
24 ---
25 drivers/mtd/nand/nand_base.c | 8 +++-----
26 1 file changed, 3 insertions(+), 5 deletions(-)
27
28 --- a/drivers/mtd/nand/nand_base.c
29 +++ b/drivers/mtd/nand/nand_base.c
30 @@ -2862,10 +2862,8 @@ static int nand_flash_detect_ext_param_p
31
32 len = le16_to_cpu(p->ext_param_page_length) * 16;
33 ep = kmalloc(len, GFP_KERNEL);
34 - if (!ep) {
35 - ret = -ENOMEM;
36 - goto ext_out;
37 - }
38 + if (!ep)
39 + return -ENOMEM;
40
41 /* Send our own NAND_CMD_PARAM. */
42 chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1);
43 @@ -2913,7 +2911,7 @@ static int nand_flash_detect_ext_param_p
44 }
45
46 pr_info("ONFI extended param page detected.\n");
47 - return 0;
48 + ret = 0;
49
50 ext_out:
51 kfree(ep);