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  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, 17 Jul 2020 20:02:22 +0530
From:   Akash Asthana <akashast@...eaurora.org>
To:     bjorn.andersson@...aro.org
Cc:     mka@...omium.org, linux-kernel@...r.kernel.org,
        saipraka@...eaurora.org, msavaliy@...eaurora.org,
        Akash Asthana <akashast@...eaurora.org>
Subject: [PATCH] soc: qcom: geni: Fix NULL pointer dereference

pdev struct doesn't exits for the devices whose status are disabled
from DT node, in such cases NULL is returned from 'of_find_device_by_node'
Later when we try to get drvdata from pdev struct NULL pointer dereference
is triggered.

Add a NULL check for return values to fix the issue.

We were hitting this issue when one of QUP is disabled.

Fixes: 048eb908a1f2 ("soc: qcom-geni-se: Add interconnect support to fix earlycon crash")
Reported-by: Sai Prakash Ranjan <saipraka@...eaurora.org>
Signed-off-by: Akash Asthana <akashast@...eaurora.org>
---
 drivers/soc/qcom/qcom-geni-se.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
index 355d503..6e5fe65 100644
--- a/drivers/soc/qcom/qcom-geni-se.c
+++ b/drivers/soc/qcom/qcom-geni-se.c
@@ -820,6 +820,7 @@ void geni_remove_earlycon_icc_vote(void)
 	struct geni_wrapper *wrapper;
 	struct device_node *parent;
 	struct device_node *child;
+	struct platform_device *wrapper_pdev;
 
 	if (!earlycon_wrapper)
 		return;
@@ -829,7 +830,12 @@ void geni_remove_earlycon_icc_vote(void)
 	for_each_child_of_node(parent, child) {
 		if (!of_device_is_compatible(child, "qcom,geni-se-qup"))
 			continue;
-		wrapper = platform_get_drvdata(of_find_device_by_node(child));
+
+		wrapper_pdev = of_find_device_by_node(child);
+		if (!wrapper_pdev)
+			continue;
+
+		wrapper = platform_get_drvdata(wrapper_pdev);
 		icc_put(wrapper->to_core.path);
 		wrapper->to_core.path = NULL;
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project

Powered by blists - more mailing lists