diff options
author | Hillf Danton <hdanton@sina.com> | 2019-08-06 11:40:15 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2019-08-06 13:42:22 +0300 |
commit | 6d4472d7bec39917b54e4e80245784ea5d60ce49 (patch) | |
tree | 56698233d5c1d5b4434003f3ff5849a3db94b6c3 /drivers/hid/usbhid | |
parent | 9c09b214f30e3c11f9b0b03f89442df03643794d (diff) | |
download | linux-6d4472d7bec39917b54e4e80245784ea5d60ce49.tar.xz |
HID: hiddev: do cleanup in failure of opening a device
Undo what we did for opening before releasing the memory slice.
Reported-by: syzbot <syzbot+62a1e04fd3ec2abf099e@syzkaller.appspotmail.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Hillf Danton <hdanton@sina.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/usbhid')
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index c07df8292380..4e11cc6fc34b 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -308,6 +308,10 @@ bail_normal_power: hid_hw_power(hid, PM_HINT_NORMAL); bail_unlock: mutex_unlock(&hiddev->existancelock); + + spin_lock_irq(&list->hiddev->list_lock); + list_del(&list->node); + spin_unlock_irq(&list->hiddev->list_lock); bail: file->private_data = NULL; vfree(list); |