diff options
author | Dan Carpenter <error27@gmail.com> | 2011-01-06 09:05:36 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2011-01-06 10:48:59 -0500 |
commit | 52d039fdaa78c5a9f9bc2940ad58d7ed76b8336d (patch) | |
tree | 7cd507681b1e2de763ddbbb5591a147a9ceb5391 /drivers/mtd | |
parent | a121f643993474548fe98144514c50dd4f3dbe76 (diff) |
mtd: pxa3xx_nand: NULL dereference in pxa3xx_nand_probe
"info->cmdset" gets dereferenced in __readid() so it needs to be
initialized earlier in the function. This bug was introduced in
18c81b1828f8 "mtd: pxa3xx_nand: remove the flash info in driver
structure".
Cc: stable@kernel.org [2.6.37+]
Reported-and-tested-by: Sven Neumann <s.neumann@raumfeld.com>
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/pxa3xx_nand.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 17f8518cc5eb..ea2c288df3f6 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
@@ -885,6 +885,7 @@ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info) | |||
885 | /* set info fields needed to __readid */ | 885 | /* set info fields needed to __readid */ |
886 | info->read_id_bytes = (info->page_size == 2048) ? 4 : 2; | 886 | info->read_id_bytes = (info->page_size == 2048) ? 4 : 2; |
887 | info->reg_ndcr = ndcr; | 887 | info->reg_ndcr = ndcr; |
888 | info->cmdset = &default_cmdset; | ||
888 | 889 | ||
889 | if (__readid(info, &id)) | 890 | if (__readid(info, &id)) |
890 | return -ENODEV; | 891 | return -ENODEV; |
@@ -915,7 +916,6 @@ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info) | |||
915 | 916 | ||
916 | info->ndtr0cs0 = nand_readl(info, NDTR0CS0); | 917 | info->ndtr0cs0 = nand_readl(info, NDTR0CS0); |
917 | info->ndtr1cs0 = nand_readl(info, NDTR1CS0); | 918 | info->ndtr1cs0 = nand_readl(info, NDTR1CS0); |
918 | info->cmdset = &default_cmdset; | ||
919 | 919 | ||
920 | return 0; | 920 | return 0; |
921 | } | 921 | } |