linux/drivers/hid
Valentine Barshak 1a8e8fab79 HID: Fix race between disconnect and hiddev_ioctl
A USB HID device can be disconnected at any time.
If this happens right before or while hiddev_ioctl is in progress,
the hiddev_ioctl tries to access invalid hiddev->hid pointer.
When the hid device is disconnected, the hiddev_disconnect()
ends up with a call to hid_device_release() which frees
hid_device, but doesn't set the hiddev->hid pointer to NULL.
If the deallocated memory region has been re-used by the kernel,
this can cause a crash or memory corruption.

Since disconnect can happen at any time, we can't initialize
struct hid_device *hid = hiddev->hid at the beginning of ioctl
and then use it.

This change checks hiddev->exist flag while holding
the existancelock and uses hid_device only if it exists.

Signed-off-by: Valentine Barshak <vbarshak@mvista.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-07 15:45:49 +01:00
..
usbhid HID: Fix race between disconnect and hiddev_ioctl 2010-12-07 15:45:49 +01:00
hid-3m-pct.c HID: 3m: Adjust major / minor axes to scale 2010-09-22 11:29:07 +02:00
hid-a4tech.c HID: fix A4Tech RP-649 horizontal scrollwheel 2010-09-17 20:42:42 +02:00
hid-apple.c HID: make translation table selection more clear 2010-11-03 10:42:02 -04:00
hid-axff.c HID: add ACRUX game controller force feedback support 2010-07-19 12:13:23 +02:00
hid-belkin.c HID: adding __init/__exit macros to module init/exit functions 2009-07-23 01:28:01 +02:00
hid-cando.c HID: Add Cando touch screen 15.6-inch product id 2010-10-13 10:47:32 +02:00
hid-cherry.c HID: allow resizing and replacing report descriptors 2010-08-09 19:52:42 +02:00
hid-chicony.c HID: adding __init/__exit macros to module init/exit functions 2009-07-23 01:28:01 +02:00
hid-core.c HID: hid-core - rename hid_blacklist to hid_have_special_driver 2010-11-28 16:37:14 +01:00
hid-cypress.c HID: allow resizing and replacing report descriptors 2010-08-09 19:52:42 +02:00
hid-debug.c Merge branches 'upstream' and 'upstream-fixes' into for-linus 2010-10-23 22:44:36 +02:00
hid-drff.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
hid-egalax.c HID: Fix for problems with eGalax/DWAV multi-touch-screen 2010-10-01 15:39:51 +02:00
hid-elecom.c HID: allow resizing and replacing report descriptors 2010-08-09 19:52:42 +02:00
hid-emsff.c HID: Add Force Feedback support for EMS Trio Linker Plus II 2010-11-01 15:13:37 -04:00
hid-ezkey.c HID: adding __init/__exit macros to module init/exit functions 2009-07-23 01:28:01 +02:00
hid-gaff.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
hid-gyration.c HID: Add the GYR4101US USB ID to hid-gyration 2010-05-24 19:07:57 +02:00
hid-ids.h HID: Add support for Perixx PERIBOARD-707 (Plus) 2010-11-25 15:59:02 +01:00
hid-input.c Merge branch 'uc-logic' into for-linus 2010-10-23 22:49:32 +02:00
hid-kensington.c HID: adding __init/__exit macros to module init/exit functions 2009-07-23 01:28:01 +02:00
hid-kye.c HID: allow resizing and replacing report descriptors 2010-08-09 19:52:42 +02:00
hid-lg2ff.c HID: force feedback support for Logitech RumblePad gamepad 2010-10-04 15:39:53 +02:00
hid-lg3ff.c HID: add driver for the Logitech Flight System G940 2010-01-13 00:26:31 +01:00
hid-lg4ff.c HID: Add support for Logitech Speed Force Wireless gaming wheel 2010-09-22 13:25:39 +02:00
hid-lg.c HID: fix mismerge in hid-lg 2010-10-23 22:59:33 +02:00
hid-lg.h HID: Add support for Logitech Speed Force Wireless gaming wheel 2010-09-22 13:25:39 +02:00
hid-lgff.c HID: add driver for the Logitech Flight System G940 2010-01-13 00:26:31 +01:00
hid-magicmouse.c HID: magicmouse: Adjust major / minor axes to scale 2010-10-01 15:42:47 +02:00
hid-microsoft.c HID: allow resizing and replacing report descriptors 2010-08-09 19:52:42 +02:00
hid-monterey.c HID: allow resizing and replacing report descriptors 2010-08-09 19:52:42 +02:00
hid-mosart.c HID: add device ID for new Asus Multitouch Controller 2010-09-08 14:30:35 +02:00
hid-ntrig.c HID: ntrig: identify firmware version 2010-09-08 11:46:19 +02:00
hid-ortek.c HID: allow resizing and replacing report descriptors 2010-08-09 19:52:42 +02:00
hid-petalynx.c HID: allow resizing and replacing report descriptors 2010-08-09 19:52:42 +02:00
hid-picolcd.c HID: picolcd: correct ordering of framebuffer freeing 2010-08-06 14:53:10 +02:00
hid-pl.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
hid-prodikeys.c HID: prodikeys: make sysfs permissions more strict 2010-11-18 16:30:34 +01:00
hid-quanta.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
hid-roccat-kone.c HID: roccat: remove obsolete kone_abi_version sysfs attribute 2010-06-21 15:20:35 +02:00
hid-roccat-kone.h HID: roccat: remove obsolete kone_abi_version sysfs attribute 2010-06-21 15:20:35 +02:00
hid-roccat-pyra.c HID: roccat: Normalized reported profile number for pyra button events. 2010-09-01 12:42:23 +02:00
hid-roccat-pyra.h HID: roccat: add driver for Roccat Pyra mouse 2010-09-01 12:41:17 +02:00
hid-roccat.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
hid-roccat.h HID: roccat: fix whitespace warning from checkpatch.pl 2010-05-31 13:53:21 +02:00
hid-samsung.c HID: allow resizing and replacing report descriptors 2010-08-09 19:52:42 +02:00
hid-sjoy.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
hid-sony.c Merge branch 'uc-logic' into for-linus 2010-10-23 22:49:32 +02:00
hid-stantum.c HID: support STmicroelectronics and Sitronix with hid-stantuml driver 2010-10-01 16:01:34 +02:00
hid-sunplus.c HID: allow resizing and replacing report descriptors 2010-08-09 19:52:42 +02:00
hid-tmff.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
hid-topseed.c HID: Add support for Perixx PERIBOARD-707 (Plus) 2010-11-25 15:59:02 +01:00
hid-twinhan.c HID: add __init/__exit macros to twinhan.c 2009-09-29 13:58:20 +02:00
hid-uclogic.c HID: uclogic: add proper support for PF1209 2010-08-23 15:08:42 +02:00
hid-wacom.c HID: wacom: make sysfs permissions more strict 2010-11-18 16:30:52 +01:00
hid-waltop.c HID: waltop: add support for Waltop Slim Tablet 12.1 inch 2010-10-01 15:34:05 +02:00
hid-zpff.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
hid-zydacron.c HID: allow resizing and replacing report descriptors 2010-08-09 19:52:42 +02:00
hidraw.c Merge branches 'upstream' and 'upstream-fixes' into for-linus 2010-10-23 22:44:36 +02:00
Kconfig HID: Add Force Feedback support for EMS Trio Linker Plus II 2010-11-01 15:13:37 -04:00
Makefile HID: Clean up makefile (-y instead of -objs) 2010-11-18 10:42:44 +01:00