lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1447050198-20562-1-git-send-email-saurabh.truth@gmail.com>
Date:	Mon,  9 Nov 2015 11:53:18 +0530
From:	Saurabh Sengar <saurabh.truth@...il.com>
To:	andy.shevchenko@...il.com
Cc:	joern@...ybastard.org, dwmw2@...radead.org,
	computersforpeace@...il.com, linux-mtd@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	Saurabh Sengar <saurabh.truth@...il.com>
Subject: [PATCH v2] mtd: phram: error handling

registering the device with NULL pointer can lead to crash,
hence fixing it

Signed-off-by: Saurabh Sengar <saurabh.truth@...il.com>
---
> Andy Shevchenko wrote:
> Hmm… Why not just checking it before an register attempt? I think user
> is in right to know as many problems as they have at one shot, with
> your patch if there are two problems the user has to try twice.
Yes, taken your feedback, fixing it here in v2 as you recommended

 drivers/mtd/devices/phram.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
index 8b66e52..46b7a8a 100644
--- a/drivers/mtd/devices/phram.c
+++ b/drivers/mtd/devices/phram.c
@@ -257,6 +257,9 @@ static int phram_setup(const char *val)
 		parse_err("illegal device length\n");
 	}
 
+	if(!name)
+		return -EINVAL;
+
 	ret = register_device(name, start, len);
 	if (!ret)
 		pr_info("%s device: %#llx at %#llx\n", name, len, start);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ