Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1265040
| From | Saurabh Sengar <saurabh.truth@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] mtd: phram: error handling |
| Date | 2015-11-08 09:50 +0100 |
| Message-ID | <qstPH-6fg-5@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
registering the device with NULL pointer can lead to crash,
hence fixing it.
Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
in case of 'illegal start address' or 'illegal device length', name pointer is getting freed.
we shouldn't register the device with NULL pointer.
drivers/mtd/devices/phram.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
index 8b66e52..9a7aed3 100644
--- a/drivers/mtd/devices/phram.c
+++ b/drivers/mtd/devices/phram.c
@@ -249,12 +249,14 @@ static int phram_setup(const char *val)
if (ret) {
kfree(name);
parse_err("illegal start address\n");
+ goto err;
}
ret = parse_num64(&len, token[2]);
if (ret) {
kfree(name);
parse_err("illegal device length\n");
+ goto err;
}
ret = register_device(name, start, len);
@@ -262,7 +264,7 @@ static int phram_setup(const char *val)
pr_info("%s device: %#llx at %#llx\n", name, len, start);
else
kfree(name);
-
+err:
return ret;
}
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] mtd: phram: error handling Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-08 09:50 +0100
Re: [PATCH] mtd: phram: error handling Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-08 22:30 +0100
[PATCH v2] mtd: phram: error handling Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-09 07:30 +0100
Re: [PATCH v2] mtd: phram: error handling Brian Norris <computersforpeace@gmail.com> - 2015-11-10 19:30 +0100
[PATCH] mtd: phram: error handling Joe Perches <joe@perches.com> - 2015-11-10 19:40 +0100
Re: [PATCH] mtd: phram: error handling Joe Perches <joe@perches.com> - 2015-11-10 19:50 +0100
Re: [PATCH] mtd: phram: error handling Brian Norris <computersforpeace@gmail.com> - 2015-11-10 20:10 +0100
[PATCH] mtd: phram: error handling Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-10 20:30 +0100
Re: [PATCH] mtd: phram: error handling Brian Norris <computersforpeace@gmail.com> - 2015-11-10 20:50 +0100
[PATCH] mtd: phram: error handling Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-11 09:30 +0100
Re: [PATCH] mtd: phram: error handling Brian Norris <computersforpeace@gmail.com> - 2015-11-11 20:50 +0100
[PATCH] mtd: phram: error handling Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-12 07:30 +0100
Re: [PATCH] mtd: phram: error handling Brian Norris <computersforpeace@gmail.com> - 2015-11-10 19:50 +0100
csiph-web