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]
Message-Id: <20200428110253.1.I926f6741079cafb04ecb592130aef75b24ad31ae@changeid>
Date:   Tue, 28 Apr 2020 11:02:56 +1000
From:   Daniil Lunev <dlunev@...omium.org>
To:     LKML <linux-kernel@...r.kernel.org>
Cc:     Prashant Malani <pmalani@...omium.org>,
        Daniil Lunev <dlunev@...omium.org>,
        Benson Leung <bleung@...omium.org>,
        Enric Balletbo i Serra <enric.balletbo@...labora.com>,
        Guenter Roeck <groeck@...omium.org>
Subject: [PATCH] platform/chrome: cros_ec_typec: Handle NULL EC pointer during probe.

Missing EC in device hierarchy causes NULL pointer to be returned to the
probe function which leads to NULL pointer dereference when trying to
send a command to the EC. This can be the case if the device is missing
or incorrectly configured in the firmware blob. Even if the situation
occures, the driver shall not cause a kernel panic as the condition is
not critical for the system functions.

Signed-off-by: Daniil Lunev <dlunev@...omium.org>
---

 drivers/platform/chrome/cros_ec_typec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index 874269c07073..30d99c930445 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -301,6 +301,11 @@ static int cros_typec_probe(struct platform_device *pdev)
 
 	typec->dev = dev;
 	typec->ec = dev_get_drvdata(pdev->dev.parent);
+	if (!typec->ec) {
+		dev_err(dev, "Failed to get Cros EC data\n");
+		return -EINVAL;
+	}
+
 	platform_set_drvdata(pdev, typec);
 
 	ret = cros_typec_get_cmd_version(typec);
-- 
2.24.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ