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-next>] [day] [month] [year] [list]
Date:   Fri, 27 Jan 2017 16:46:45 +0530
From:   Shailendra Verma <shailendra.v@...sung.com>
To:     Lee Jones <lee.jones@...aro.org>, linux-kernel@...r.kernel.org,
        p.shailesh@...sung.com, ashish.kalra@...sung.com,
        Shailendra Verma <shailendra.v@...sung.com>,
        Shailendra Verma <shailendra.capricorn@...il.com>
Subject: [PATCH] Mfd - Fix possible NULL derefrence.

of_match_device could return NULL, and so can cause a NULL
pointer dereference later.

Signed-off-by: Shailendra Verma <shailendra.v@...sung.com>
---
 drivers/mfd/mc13xxx-i2c.c |    4 ++++
 drivers/mfd/mc13xxx-spi.c |    5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c
index 67e4c9a..e03f454 100644
--- a/drivers/mfd/mc13xxx-i2c.c
+++ b/drivers/mfd/mc13xxx-i2c.c
@@ -80,6 +80,10 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,
 	if (client->dev.of_node) {
 		const struct of_device_id *of_id =
 			of_match_device(mc13xxx_dt_ids, &client->dev);
+		if (!of_id) {
+			dev_err(&client->dev, "Error: No device match found\n");
+			return -ENODEV;
+		}
 		mc13xxx->variant = of_id->data;
 	} else {
 		mc13xxx->variant = (void *)id->driver_data;
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index cbc1e5e..97ab19c 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -157,7 +157,10 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
 	if (spi->dev.of_node) {
 		const struct of_device_id *of_id =
 			of_match_device(mc13xxx_dt_ids, &spi->dev);
+		if (!of_id) {
+			dev_err(&spi->dev, "Error: No device match found\n");
+			return -ENODEV;
+		}
 		mc13xxx->variant = of_id->data;
 	} else {
 		const struct spi_device_id *id_entry = spi_get_device_id(spi);
-- 
1.7.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ