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] [day] [month] [year] [list]
Date:	Thu, 19 Apr 2012 12:06:45 +0200
From:	"Henrik Rydberg" <rydberg@...omail.se>
To:	Jiri Kosina <jkosina@...e.cz>
Cc:	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Benjamin Tissoires <benjamin.tissoires@...il.com>,
	Stephane Chatty <chatty@...c.fr>, linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/5] hid: Add device group to modalias

On Thu, Apr 19, 2012 at 12:00:53AM +0200, Henrik Rydberg wrote:
> HID devices are only partially presented to userland.  Hotplugged
> devices emit events containing a modalias based on the basic bus,
> vendor and product entities. However, in practise a hid device can
> depend on details such as a single usb interface or a particular item
> in a report descriptor.
> 
> This patch adds a device group to the hid device id, and broadcasts it
> using uevent and the device modalias.  The module alias generation is
> modified to match. As a consequence, a device with a non-zero group
> will be processed by the corresponding group driver instead of by the
> generic hid driver.
> 
> Signed-off-by: Henrik Rydberg <rydberg@...omail.se>
> ---

Addition for v2: store_new_id() needs to be modified as well, in order
for the added devices to match the right device group. Something like
the below should suffice.

Henrik

---

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 4845567..3c9bf3e 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -580,6 +576,17 @@ const struct hid_device_id *hid_match_id(struct hid_device *hdev,
 	return NULL;
 }
 
+static int hid_get_driver_group(const struct hid_driver *hdrv)
+{
+	const struct hid_device_id *id;
+	int group = 0;
+
+	for (id = hdrv->id_table; id->bus; id++)
+		group = id->group;
+
+	return group;
+}
+
 static const struct hid_device_id hid_hiddev_list[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1) },
@@ -977,6 +984,7 @@ static ssize_t store_new_id(struct device_driver *drv, const char *buf,
 		return -ENOMEM;
 
 	dynid->id.bus = bus;
+	dynid->id.group = hid_get_driver_group(hdrv);
 	dynid->id.vendor = vendor;
 	dynid->id.product = product;
 	dynid->id.driver_data = driver_data;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ