linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [GIT PULL] HID
       [not found] <alpine.LNX.2.00.1408211146110.23162@pobox.suse.cz>
@ 2014-08-22  7:40 ` Markus Trippelsdorf
  2014-08-22  8:00   ` Jiri Kosina
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Trippelsdorf @ 2014-08-22  7:40 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-input, linux-kernel, Ben Hawkes, Benjamin Tissoires

On 2014.08.21 at 12:43 -0500, Jiri Kosina wrote:

>       HID: logitech: perform bounds checking on device_id early enough

The commit above (ad3e14d7c5268c2e) causes the bounds checking to always
fail on my monolithic kernel (without modules):

...
[    2.922617] usb 4-2: new full-speed USB device number 2 using ohci-pci
[    2.996587] udevd[98]: starting eudev version 1.0
[    3.071203] random: nonblocking pool is initialized
[    3.108360] logitech-djreceiver 0003:046D:C52B.0003: hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:00:12.1-2/input2
[    3.163208] input: Logitech Unifying Device. Wireless PID:4026 as /devices/pci0000:00/0000:00:12.1/usb4/4-2/4-2:1.2/0003:046D:C52B.0003/0003:046D:C52B.0004/input/input2
[    3.163511] logitech-djdevice 0003:046D:C52B.0004: input,hidraw1: USB HID v1.11 Keyboard [Logitech Unifying Device. Wireless PID:4026] on usb-0000:00:12.1-2:1
[    3.164121] logitech-djreceiver 0003:046D:C52B.0003: logi_dj_raw_event: invalid device index:0
[    3.289261] usb 3-1: new low-speed USB device number 2 using ohci-pci
[    3.457606] input: HID 046a:0011 as /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/0003:046A:0011.0005/input/input3
[    3.457794] hid-generic 0003:046A:0011.0005: input,hidraw2: USB HID v1.10 Keyboard [HID 046a:0011] on usb-0000:00:12.0-1/input0
[    3.712886] Switched to clocksource tsc
...

-- 
Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GIT PULL] HID
  2014-08-22  7:40 ` [GIT PULL] HID Markus Trippelsdorf
@ 2014-08-22  8:00   ` Jiri Kosina
  2014-08-22  8:18     ` Markus Trippelsdorf
  0 siblings, 1 reply; 4+ messages in thread
From: Jiri Kosina @ 2014-08-22  8:00 UTC (permalink / raw)
  To: Markus Trippelsdorf
  Cc: linux-input, linux-kernel, Ben Hawkes, Benjamin Tissoires

On Fri, 22 Aug 2014, Markus Trippelsdorf wrote:

> >       HID: logitech: perform bounds checking on device_id early enough
> 
> The commit above (ad3e14d7c5268c2e) causes the bounds checking to always
> fail on my monolithic kernel (without modules):
> 
> ...
> [    2.922617] usb 4-2: new full-speed USB device number 2 using ohci-pci
> [    2.996587] udevd[98]: starting eudev version 1.0
> [    3.071203] random: nonblocking pool is initialized
> [    3.108360] logitech-djreceiver 0003:046D:C52B.0003: hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:00:12.1-2/input2
> [    3.163208] input: Logitech Unifying Device. Wireless PID:4026 as /devices/pci0000:00/0000:00:12.1/usb4/4-2/4-2:1.2/0003:046D:C52B.0003/0003:046D:C52B.0004/input/input2
> [    3.163511] logitech-djdevice 0003:046D:C52B.0004: input,hidraw1: USB HID v1.11 Keyboard [Logitech Unifying Device. Wireless PID:4026] on usb-0000:00:12.1-2:1
> [    3.164121] logitech-djreceiver 0003:046D:C52B.0003: logi_dj_raw_event: invalid device index:0
> [    3.289261] usb 3-1: new low-speed USB device number 2 using ohci-pci
> [    3.457606] input: HID 046a:0011 as /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/0003:046A:0011.0005/input/input3
> [    3.457794] hid-generic 0003:046A:0011.0005: input,hidraw2: USB HID v1.10 Keyboard [HID 046a:0011] on usb-0000:00:12.0-1/input0
> [    3.712886] Switched to clocksource tsc

Thanks a lot for a timely report.

I am travelling till next week and don't unfortunately have the hardware 
here with me to test momentarily, so please take this with a lot of grains 
of salt (maybe Benjamin would be able to look into this before I'd be able 
to on monday ... ?).

Does the shot-in-the-dakr patch below put things back in shape for you?


diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index b7ba829..d9ae77f 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -861,7 +861,7 @@ static void logi_dj_remove(struct hid_device *hdev)
 	 * have finished and no more raw_event callbacks should arrive after
 	 * the remove callback was triggered so no locks are put around the
 	 * code below */
-	for (i = 0; i < (DJ_MAX_PAIRED_DEVICES + DJ_DEVICE_INDEX_MIN); i++) {
+	for (i = 0; i < (DJ_MAX_PAIRED_DEVICES + DJ_DEVICE_INDEX_MIN + 1); i++) {
 		dj_dev = djrcv_dev->paired_dj_devices[i];
 		if (dj_dev != NULL) {
 			hid_destroy_device(dj_dev->hdev);
diff --git a/drivers/hid/hid-logitech-dj.h b/drivers/hid/hid-logitech-dj.h
index 4a40003..1f630e4 100644
--- a/drivers/hid/hid-logitech-dj.h
+++ b/drivers/hid/hid-logitech-dj.h
@@ -27,8 +27,8 @@
 
 #define DJ_MAX_PAIRED_DEVICES			6
 #define DJ_MAX_NUMBER_NOTIFICATIONS		8
-#define DJ_DEVICE_INDEX_MIN 			1
-#define DJ_DEVICE_INDEX_MAX 			6
+#define DJ_DEVICE_INDEX_MIN 			0
+#define DJ_DEVICE_INDEX_MAX 			5
 
 #define DJREPORT_SHORT_LENGTH			15
 #define DJREPORT_LONG_LENGTH			32
@@ -97,7 +97,7 @@ struct dj_report {
 struct dj_receiver_dev {
 	struct hid_device *hdev;
 	struct dj_device *paired_dj_devices[DJ_MAX_PAIRED_DEVICES +
-					    DJ_DEVICE_INDEX_MIN];
+					    DJ_DEVICE_INDEX_MIN + 1];
 	struct work_struct work;
 	struct kfifo notif_fifo;
 	spinlock_t lock;

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [GIT PULL] HID
  2014-08-22  8:00   ` Jiri Kosina
@ 2014-08-22  8:18     ` Markus Trippelsdorf
  2014-08-22 14:25       ` Benjamin Tissoires
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Trippelsdorf @ 2014-08-22  8:18 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-input, linux-kernel, Ben Hawkes, Benjamin Tissoires

On 2014.08.22 at 03:00 -0500, Jiri Kosina wrote:
> On Fri, 22 Aug 2014, Markus Trippelsdorf wrote:
> 
> > >       HID: logitech: perform bounds checking on device_id early enough
> > 
> > The commit above (ad3e14d7c5268c2e) causes the bounds checking to always
> > fail on my monolithic kernel (without modules):
> > 
> > ...
> > [    2.922617] usb 4-2: new full-speed USB device number 2 using ohci-pci
> > [    2.996587] udevd[98]: starting eudev version 1.0
> > [    3.071203] random: nonblocking pool is initialized
> > [    3.108360] logitech-djreceiver 0003:046D:C52B.0003: hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:00:12.1-2/input2
> > [    3.163208] input: Logitech Unifying Device. Wireless PID:4026 as /devices/pci0000:00/0000:00:12.1/usb4/4-2/4-2:1.2/0003:046D:C52B.0003/0003:046D:C52B.0004/input/input2
> > [    3.163511] logitech-djdevice 0003:046D:C52B.0004: input,hidraw1: USB HID v1.11 Keyboard [Logitech Unifying Device. Wireless PID:4026] on usb-0000:00:12.1-2:1
> > [    3.164121] logitech-djreceiver 0003:046D:C52B.0003: logi_dj_raw_event: invalid device index:0
> > [    3.289261] usb 3-1: new low-speed USB device number 2 using ohci-pci
> > [    3.457606] input: HID 046a:0011 as /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/0003:046A:0011.0005/input/input3
> > [    3.457794] hid-generic 0003:046A:0011.0005: input,hidraw2: USB HID v1.10 Keyboard [HID 046a:0011] on usb-0000:00:12.0-1/input0
> > [    3.712886] Switched to clocksource tsc
> 
> Thanks a lot for a timely report.
> 
> I am travelling till next week and don't unfortunately have the hardware 
> here with me to test momentarily, so please take this with a lot of grains 
> of salt (maybe Benjamin would be able to look into this before I'd be able 
> to on monday ... ?).
> 
> Does the shot-in-the-dark patch below put things back in shape for you?

Thanks a lot for the timely patch. It indeed fixes the issue for me.

-- 
Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GIT PULL] HID
  2014-08-22  8:18     ` Markus Trippelsdorf
@ 2014-08-22 14:25       ` Benjamin Tissoires
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Tissoires @ 2014-08-22 14:25 UTC (permalink / raw)
  To: Markus Trippelsdorf; +Cc: Jiri Kosina, linux-input, linux-kernel, Ben Hawkes

On Aug 22 2014 or thereabouts, Markus Trippelsdorf wrote:
> On 2014.08.22 at 03:00 -0500, Jiri Kosina wrote:
> > On Fri, 22 Aug 2014, Markus Trippelsdorf wrote:
> > 
> > > >       HID: logitech: perform bounds checking on device_id early enough
> > > 
> > > The commit above (ad3e14d7c5268c2e) causes the bounds checking to always
> > > fail on my monolithic kernel (without modules):
> > > 
> > > ...
> > > [    2.922617] usb 4-2: new full-speed USB device number 2 using ohci-pci
> > > [    2.996587] udevd[98]: starting eudev version 1.0
> > > [    3.071203] random: nonblocking pool is initialized
> > > [    3.108360] logitech-djreceiver 0003:046D:C52B.0003: hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:00:12.1-2/input2
> > > [    3.163208] input: Logitech Unifying Device. Wireless PID:4026 as /devices/pci0000:00/0000:00:12.1/usb4/4-2/4-2:1.2/0003:046D:C52B.0003/0003:046D:C52B.0004/input/input2
> > > [    3.163511] logitech-djdevice 0003:046D:C52B.0004: input,hidraw1: USB HID v1.11 Keyboard [Logitech Unifying Device. Wireless PID:4026] on usb-0000:00:12.1-2:1
> > > [    3.164121] logitech-djreceiver 0003:046D:C52B.0003: logi_dj_raw_event: invalid device index:0
> > > [    3.289261] usb 3-1: new low-speed USB device number 2 using ohci-pci
> > > [    3.457606] input: HID 046a:0011 as /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/0003:046A:0011.0005/input/input3
> > > [    3.457794] hid-generic 0003:046A:0011.0005: input,hidraw2: USB HID v1.10 Keyboard [HID 046a:0011] on usb-0000:00:12.0-1/input0
> > > [    3.712886] Switched to clocksource tsc
> > 
> > Thanks a lot for a timely report.
> > 
> > I am travelling till next week and don't unfortunately have the hardware 
> > here with me to test momentarily, so please take this with a lot of grains 
> > of salt (maybe Benjamin would be able to look into this before I'd be able 
> > to on monday ... ?).
> > 
> > Does the shot-in-the-dark patch below put things back in shape for you?
> 
> Thanks a lot for the timely patch. It indeed fixes the issue for me.
> 

Huh, my bad, I should have actually test Jiri's patch instead of
thinking "this can not break anything".

So Jiri, your patch does not work because the device index 0 is the
receiver, and 1-6 are the wireless devices attached to this receiver. So
basically, this new patch removes the ability to have 6 devices paired.

I'll try to come out with something by the end of the day which would
both prevent the out of bound and allow to have 6 true wireless devices.

Cheers,
Benjamin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-22 14:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <alpine.LNX.2.00.1408211146110.23162@pobox.suse.cz>
2014-08-22  7:40 ` [GIT PULL] HID Markus Trippelsdorf
2014-08-22  8:00   ` Jiri Kosina
2014-08-22  8:18     ` Markus Trippelsdorf
2014-08-22 14:25       ` Benjamin Tissoires

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).