mtd: check for valid pdata inside plat_nand
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sat Sep 29 10:59:08 EDT 2012
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=da3888cb84065a03d30b5f729b405e573bd0d66e
Commit: da3888cb84065a03d30b5f729b405e573bd0d66e
Parent: b8c4bf26109878d39b5e6d1425b8c9cd562ef525
Author: John Crispin <blogic at openwrt.org>
AuthorDate: Sun Jul 22 08:59:57 2012 +0200
Committer: David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Sat Sep 29 15:01:52 2012 +0100
mtd: check for valid pdata inside plat_nand
If plat_nand loads and the platform_data is not properly set it will segfault.
Signed-off-by: John Crispin <blogic at openwrt.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
drivers/mtd/nand/plat_nand.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c
index 1bcb520..a47ee68 100644
--- a/drivers/mtd/nand/plat_nand.c
+++ b/drivers/mtd/nand/plat_nand.c
@@ -37,6 +37,11 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
const char **part_types;
int err = 0;
+ if (!pdata) {
+ dev_err(&pdev->dev, "platform_nand_data is missing\n");
+ return -EINVAL;
+ }
+
if (pdata->chip.nr_chips < 1) {
dev_err(&pdev->dev, "invalid number of chips specified\n");
return -EINVAL;
More information about the linux-mtd-cvs
mailing list