Skip to content

Commit d1126ad

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: USB HID: Add ID for eGalax Multitouch used in JooJoo tablet HID: hiddev: fix memory corruption due to invalid intfdata HID: hiddev: protect against disconnect/NULL-dereference race HID: picolcd: correct ordering of framebuffer freeing HID: picolcd: testing the wrong variable
2 parents 2a55473 + 83e4491 commit d1126ad

5 files changed

Lines changed: 20 additions & 6 deletions

File tree

‎drivers/hid/hid-core.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,7 @@ static const struct hid_device_id hid_blacklist[] = {
12991299
{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
13001300
{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) },
13011301
{ HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
1302+
{ HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
13021303
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) },
13031304
{ HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
13041305
{ HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },

‎drivers/hid/hid-egalax.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ static int egalax_event(struct hid_device *hid, struct hid_field *field,
159159
{
160160
struct egalax_data *td = hid_get_drvdata(hid);
161161

162+
/* Note, eGalax has two product lines: the first is resistive and
163+
* uses a standard parallel multitouch protocol (product ID ==
164+
* 48xx). The second is capacitive and uses an unusual "serial"
165+
* protocol with a different message for each multitouch finger
166+
* (product ID == 72xx). We do not yet generate a correct event
167+
* sequence for the capacitive/serial protocol.
168+
*/
162169
if (hid->claimed & HID_CLAIMED_INPUT) {
163170
struct input_dev *input = field->hidinput->input;
164171

@@ -246,6 +253,8 @@ static void egalax_remove(struct hid_device *hdev)
246253
static const struct hid_device_id egalax_devices[] = {
247254
{ HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
248255
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
256+
{ HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
257+
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
249258
{ }
250259
};
251260
MODULE_DEVICE_TABLE(hid, egalax_devices);

‎drivers/hid/hid-ids.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188
#define USB_VENDOR_ID_DWAV 0x0eef
189189
#define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER 0x0001
190190
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH 0x480d
191+
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1 0x720c
191192

192193
#define USB_VENDOR_ID_ELECOM 0x056e
193194
#define USB_DEVICE_ID_ELECOM_BM084 0x0061

‎drivers/hid/hid-picolcd.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,11 +547,11 @@ static void picolcd_fb_destroy(struct fb_info *info)
547547
ref_cnt--;
548548
mutex_lock(&info->lock);
549549
(*ref_cnt)--;
550-
may_release = !ref_cnt;
550+
may_release = !*ref_cnt;
551551
mutex_unlock(&info->lock);
552552
if (may_release) {
553-
framebuffer_release(info);
554553
vfree((u8 *)info->fix.smem_start);
554+
framebuffer_release(info);
555555
}
556556
}
557557

‎drivers/hid/usbhid/hiddev.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,15 @@ static int hiddev_open(struct inode *inode, struct file *file)
266266
{
267267
struct hiddev_list *list;
268268
struct usb_interface *intf;
269+
struct hid_device *hid;
269270
struct hiddev *hiddev;
270271
int res;
271272

272273
intf = usb_find_interface(&hiddev_driver, iminor(inode));
273274
if (!intf)
274275
return -ENODEV;
275-
hiddev = usb_get_intfdata(intf);
276+
hid = usb_get_intfdata(intf);
277+
hiddev = hid->hiddev;
276278

277279
if (!(list = kzalloc(sizeof(struct hiddev_list), GFP_KERNEL)))
278280
return -ENOMEM;
@@ -587,7 +589,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
587589
struct hiddev_list *list = file->private_data;
588590
struct hiddev *hiddev = list->hiddev;
589591
struct hid_device *hid = hiddev->hid;
590-
struct usb_device *dev = hid_to_usb_dev(hid);
592+
struct usb_device *dev;
591593
struct hiddev_collection_info cinfo;
592594
struct hiddev_report_info rinfo;
593595
struct hiddev_field_info finfo;
@@ -601,9 +603,11 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
601603
/* Called without BKL by compat methods so no BKL taken */
602604

603605
/* FIXME: Who or what stop this racing with a disconnect ?? */
604-
if (!hiddev->exist)
606+
if (!hiddev->exist || !hid)
605607
return -EIO;
606608

609+
dev = hid_to_usb_dev(hid);
610+
607611
switch (cmd) {
608612

609613
case HIDIOCGVERSION:
@@ -888,7 +892,6 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
888892
hid->hiddev = hiddev;
889893
hiddev->hid = hid;
890894
hiddev->exist = 1;
891-
usb_set_intfdata(usbhid->intf, usbhid);
892895
retval = usb_register_dev(usbhid->intf, &hiddev_class);
893896
if (retval) {
894897
err_hid("Not able to get a minor for this device.");

0 commit comments

Comments
 (0)