]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerSasha Levin <alexander.levin@microsoft.com>
Wed, 23 May 2018 01:36:35 +0000 (21:36 -0400)
commit9c76f2e7de2588082b485d992a02a8372e3a4628
treea9614e1684e0c5cfede548e714a40db67bd89eb5
parent9d2fbe826b3efac986d6f28084d3e84dd702f542
HID: hidraw: Fix crash on HIDIOCGFEATURE with a destroyed device

[ Upstream commit a955358d54695e4ad9f7d6489a7ac4d69a8fc711 ]

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: Sasha Levin <alexander.levin@microsoft.com>
drivers/hid/hidraw.c