diff options
| author | Alan Stern <[email protected]> | 2020-04-22 20:18:48 +0000 |
|---|---|---|
| committer | Jiri Kosina <[email protected]> | 2020-04-29 14:24:26 +0000 |
| commit | 0ed08faded1da03eb3def61502b27f81aef2e615 (patch) | |
| tree | 35b05447dc4293e0a4c29368253c432d8e071048 /tools/perf/scripts/python/failed-syscalls-by-pid.py | |
| parent | Revert "HID: wacom: generic: read the number of expected touches on a per col... (diff) | |
| download | kernel-0ed08faded1da03eb3def61502b27f81aef2e615.tar.gz kernel-0ed08faded1da03eb3def61502b27f81aef2e615.zip | |
HID: usbhid: Fix race between usbhid_close() and usbhid_stop()
The syzbot fuzzer discovered a bad race between in the usbhid driver
between usbhid_stop() and usbhid_close(). In particular,
usbhid_stop() does:
usb_free_urb(usbhid->urbin);
...
usbhid->urbin = NULL; /* don't mess up next start */
and usbhid_close() does:
usb_kill_urb(usbhid->urbin);
with no mutual exclusion. If the two routines happen to run
concurrently so that usb_kill_urb() is called in between the
usb_free_urb() and the NULL assignment, it will access the
deallocated urb structure -- a use-after-free bug.
This patch adds a mutex to the usbhid private structure and uses it to
enforce mutual exclusion of the usbhid_start(), usbhid_stop(),
usbhid_open() and usbhid_close() callbacks.
Reported-and-tested-by: [email protected]
Signed-off-by: Alan Stern <[email protected]>
CC: <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/failed-syscalls-by-pid.py')
0 files changed, 0 insertions, 0 deletions
