]> git.ipfire.org Git - people/arne_f/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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Apr 2018 07:43:07 +0000 (09:43 +0200)
commit6bfcef16fb90665a565a24ae45737cc01ffad234
tree0643636309437dbc37b092d4a59c13d4b0a1fca7
parent3bca55081843dcdbbd6ad1045c9b6aecbcaea053
HID: hidraw: Fix crash on HIDIOCGFEATURE with a destroyed device

commit a955358d54695e4ad9f7d6489a7ac4d69a8fc711 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/hidraw.c