]> git.baikalelectronics.ru Git - kernel.git/commit
HID: hidraw: Fix crash on HIDIOCGFEATURE with a destroyed device
authorRodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Thu, 5 Apr 2018 23:09:36 +0000 (01:09 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 9 Apr 2018 07:30:25 +0000 (09:30 +0200)
commitd2deaed71d1c1e8a9ff4645c900ba7a5c4d452d1
tree7c7e5664208ad40c7d51fc2f98bf72358b7abba8
parent99b4d203ec19b7cd9d289559b1c4ce237d5810cf
HID: hidraw: Fix crash on HIDIOCGFEATURE with a destroyed device

Doing `ioctl(HIDIOCGFEATURE)` in a tight loop on a hidraw device
and then disconnecting the device, or unloading the driver, can
cause a NULL pointer dereference.

When a hidraw device is destroyed it sets 0 to `dev->exist`.
Most functions check 'dev->exist' before doing its work, but
`hidraw_get_report()` was missing that check.

Cc: stable@vger.kernel.org
Signed-off-by: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hidraw.c