summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-07-15 14:06:30 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-30 10:12:45 +0200
commit3f98badc15b1efa2f3ff1ea865c0e9282df50fea (patch)
tree8aac439e3b9da5b0824d7809461b47b1d48495c2
parent753de51f8aa9e0550aa8a4730cf1e4869e6488f4 (diff)
downloadlinux-stable-3f98badc15b1efa2f3ff1ea865c0e9282df50fea.tar.gz
linux-stable-3f98badc15b1efa2f3ff1ea865c0e9282df50fea.tar.bz2
linux-stable-3f98badc15b1efa2f3ff1ea865c0e9282df50fea.zip
mtd: maps: sa1100-flash: potential NULL dereference
commit dc01a28d80a42cef08c94dfc595565aaebe46d15 upstream. We check for NULL but then dereference "info->mtd" on the next line. Fixes: 72169755cf36 ('mtd: maps: sa1100-flash: show parent device in sysfs') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/mtd/maps/sa1100-flash.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index 142fc3d79463..784c6e1a0391 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -230,8 +230,10 @@ static struct sa_info *sa1100_setup_mtd(struct platform_device *pdev,
info->mtd = mtd_concat_create(cdev, info->num_subdev,
plat->name);
- if (info->mtd == NULL)
+ if (info->mtd == NULL) {
ret = -ENXIO;
+ goto err;
+ }
}
info->mtd->dev.parent = &pdev->dev;