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:   Sat, 15 Jul 2023 21:24:16 +0000
From:   Barnabás Pőcze <pobrn@...tonmail.com>
To:     linux-kernel@...r.kernel.org, platform-driver-x86@...r.kernel.org,
        Mark Gross <markgross@...nel.org>,
        Hans de Goede <hdegoede@...hat.com>,
        Armin Wolf <W_Armin@....de>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [RFC PATCH v1] platform/x86: wmi: Do not register driver with invalid GUID

Since a WMI driver's ID table contains strings it is relatively
easy to make mistakes. At the moment, there is no feedback
if any of the specified GUIDs are invalid (since
028e6e204ace1f080cfeacd72c50397eb8ae8883).

So check if the GUIDs in the driver's ID table are valid,
print all invalid ones, and refuse to register the driver
if any of the GUIDs are invalid.

Signed-off-by: Barnabás Pőcze <pobrn@...tonmail.com>
---
 drivers/platform/x86/wmi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index a78ddd83cda0..bf0be40b418a 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -1513,6 +1513,19 @@ static int acpi_wmi_probe(struct platform_device *device)
 int __must_check __wmi_driver_register(struct wmi_driver *driver,
 				       struct module *owner)
 {
+	bool any_id_invalid = false;
+
+	for (const struct wmi_device_id *id = driver->id_table; *id->guid_string; id++) {
+		if (!uuid_is_valid(id->guid_string)) {
+			pr_err("driver '%s' has invalid GUID: %s",
+			       driver->driver.name, id->guid_string);
+			any_id_invalid = true;
+		}
+	}
+
+	if (any_id_invalid)
+		return -EINVAL;
+
 	driver->driver.owner = owner;
 	driver->driver.bus = &wmi_bus_type;
 
-- 
2.41.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ