diff options
author | Nestor Lopez Casado <nlopezcasad@logitech.com> | 2011-09-20 09:59:03 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-09-20 10:09:22 -0400 |
commit | 844580ff63ef4eb19eec4cfd8cd6e0b62d81279f (patch) | |
tree | 09efe63d4917899fd8adb340867f3662f6579895 /drivers/hid/hid-logitech-dj.c | |
parent | 534a7b8e10ec55d9f521e68c20dbb3634c25b98a (diff) |
HID: hid-logitech-dj: fix off by one
There is a bug where a device with index 6 would write out of bounds in
the array of paired devices.
This patch fixes that problem.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Olivier Gay <ogay@logitech.com>
Signed-off-by: Nestor Lopez Casado <nlopezcasad@logitech.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-logitech-dj.c')
-rw-r--r-- | drivers/hid/hid-logitech-dj.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 5bb6f42a4278..38b12e45780c 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c | |||
@@ -179,9 +179,6 @@ static const u8 hid_reportid_size_map[NUMBER_OF_HID_REPORTS] = { | |||
179 | 179 | ||
180 | #define LOGITECH_DJ_INTERFACE_NUMBER 0x02 | 180 | #define LOGITECH_DJ_INTERFACE_NUMBER 0x02 |
181 | 181 | ||
182 | #define DJ_DEVICE_INDEX_MIN 1 | ||
183 | #define DJ_DEVICE_INDEX_MAX 6 | ||
184 | |||
185 | static struct hid_ll_driver logi_dj_ll_driver; | 182 | static struct hid_ll_driver logi_dj_ll_driver; |
186 | 183 | ||
187 | static int logi_dj_output_hidraw_report(struct hid_device *hid, u8 * buf, | 184 | static int logi_dj_output_hidraw_report(struct hid_device *hid, u8 * buf, |
@@ -823,7 +820,7 @@ static void logi_dj_remove(struct hid_device *hdev) | |||
823 | * have finished and no more raw_event callbacks should arrive after | 820 | * have finished and no more raw_event callbacks should arrive after |
824 | * the remove callback was triggered so no locks are put around the | 821 | * the remove callback was triggered so no locks are put around the |
825 | * code below */ | 822 | * code below */ |
826 | for (i = 0; i < DJ_MAX_PAIRED_DEVICES; i++) { | 823 | for (i = 0; i < (DJ_MAX_PAIRED_DEVICES + DJ_DEVICE_INDEX_MIN); i++) { |
827 | dj_dev = djrcv_dev->paired_dj_devices[i]; | 824 | dj_dev = djrcv_dev->paired_dj_devices[i]; |
828 | if (dj_dev != NULL) { | 825 | if (dj_dev != NULL) { |
829 | hid_destroy_device(dj_dev->hdev); | 826 | hid_destroy_device(dj_dev->hdev); |