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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190423160605.9970-1-jeffrey.l.hugo@gmail.com>
Date:   Tue, 23 Apr 2019 09:06:05 -0700
From:   Jeffrey Hugo <jeffrey.l.hugo@...il.com>
To:     dmitry.torokhov@...il.com, jikos@...nel.org,
        benjamin.tissoires@...hat.com
Cc:     lee.jones@...aro.org, bjorn.andersson@...aro.org,
        robh+dt@...nel.org, mark.rutland@....com, agross@...nel.org,
        david.brown@...aro.org, hdegoede@...hat.com,
        linux-input@...r.kernel.org, devicetree@...r.kernel.org,
        linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jeffrey Hugo <jeffrey.l.hugo@...il.com>
Subject: [PATCH v4 1/2] HID: quirks: Refactor ELAN 400 and 401 handling

There needs to be coordination between hid-quirks and the elan_i2c driver
about which devices are handled by what drivers.  Currently, both use
whitelists, which results in valid devices being unhandled by default,
when they should not be rejected by hid-quirks.  This is quickly becoming
an issue.

Since elan_i2c has a maintained whitelist of what devices it will handle,
use that to implement a blacklist in hid-quirks so that only the devices
that need to be handled by elan_i2c get rejected by hid-quirks, and
everything else is handled by default.  The downside is the whitelist and
blacklist need to be kept in sync.

Suggested-by: Benjamin Tissoires <benjamin.tissoires@...hat.com>
Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@...il.com>
---
 drivers/hid/hid-quirks.c            | 64 ++++++++++++++++++++++++-----
 drivers/input/mouse/elan_i2c_core.c |  4 ++
 2 files changed, 58 insertions(+), 10 deletions(-)

diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index 77ffba48cc73..656485e08eb7 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -987,17 +987,61 @@ bool hid_ignore(struct hid_device *hdev)
 		break;
 	case USB_VENDOR_ID_ELAN:
 		/*
-		 * Many Elan devices have a product id of 0x0401 and are handled
-		 * by the elan_i2c input driver. But the ACPI HID ELAN0800 dev
-		 * is not (and cannot be) handled by that driver ->
-		 * Ignore all 0x0401 devs except for the ELAN0800 dev.
+		 * Blacklist of everything that gets handled by the elan_i2c
+		 * input driver.  This should be kept in sync with the whitelist
+		 * that exists in that driver.  This avoids disabling valid
+		 * touchpads and other ELAN devices.
 		 */
-		if (hdev->product == 0x0401 &&
-		    strncmp(hdev->name, "ELAN0800", 8) != 0)
-			return true;
-		/* Same with product id 0x0400 */
-		if (hdev->product == 0x0400 &&
-		    strncmp(hdev->name, "QTEC0001", 8) != 0)
+		if ((hdev->product == 0x0401 || hdev->product == 0x0400) &&
+		   (strncmp(hdev->name, "ELAN0000", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0100", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0600", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0601", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0602", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0603", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0604", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0605", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0606", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0607", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0608", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0609", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN060B", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN060C", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN060F", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0610", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0611", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0612", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0613", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0614", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0615", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0616", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0617", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0618", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0619", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN061A", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN061B", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN061C", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN061D", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN061E", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN061F", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0620", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0621", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0622", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0623", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0624", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0625", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0626", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0627", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0628", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0629", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN062A", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN062B", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN062C", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN062D", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0631", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN0632", 8) == 0 ||
+		    strncmp(hdev->name, "ELAN1000", 8) == 0 ||
+		    strncmp(hdev->name, "elan,ekth3000", 13) == 0))
 			return true;
 		break;
 	}
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index f9525d6f0bfe..3ded19528cd4 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -1332,6 +1332,10 @@ static const struct i2c_device_id elan_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, elan_id);
 
+/*
+ * when these whtielists get updated, the corresponding blacklist in hid-quirks
+ * needs to be updated to match.
+ */
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id elan_acpi_id[] = {
 	{ "ELAN0000", 0 },
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ