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>] [day] [month] [year] [list]
Date:   Fri,  7 Jul 2017 14:42:30 -0700
From:   sathyanarayanan.kuppuswamy@...ux.intel.com
To:     peda@...ntia.se
Cc:     linux-kernel@...r.kernel.org, sathyaosid@...il.com,
        Kuppuswamy Sathyanarayanan 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>
Subject: [PATCH v1 1/1] mux: mux-core: Add NULL check for dev->of_node

From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>

If dev->of_node is NULL, then calling mux_control_get()
function can lead to NULL pointer exception. So adding
a NULL check for dev->of_node.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>
---
 drivers/mux/mux-core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mux/mux-core.c b/drivers/mux/mux-core.c
index 90b8995..f226662 100644
--- a/drivers/mux/mux-core.c
+++ b/drivers/mux/mux-core.c
@@ -438,6 +438,9 @@ struct mux_control *mux_control_get(struct device *dev, const char *mux_name)
 	int index = 0;
 	int ret;
 
+	if (!np)
+		return ERR_PTR(-ENODEV);
+
 	if (mux_name) {
 		index = of_property_match_string(np, "mux-control-names",
 						 mux_name);
@@ -448,6 +451,7 @@ struct mux_control *mux_control_get(struct device *dev, const char *mux_name)
 		}
 	}
 
+
 	ret = of_parse_phandle_with_args(np,
 					 "mux-controls", "#mux-control-cells",
 					 index, &args);
-- 
2.7.4

Powered by blists - more mailing lists