diff options
author | Hillf Danton <hdanton@sina.com> | 2019-08-06 16:40:15 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-08-25 10:47:49 +0200 |
commit | b545dc9debe69ca513b93f4a244451e9be14b0c5 (patch) | |
tree | 07773350e11d9278fc1d5b055b9da1b51f912d40 /drivers/hid | |
parent | 0aab1a4653a6a21509e8add4bb460be76fcf9c70 (diff) | |
download | linux-stable-b545dc9debe69ca513b93f4a244451e9be14b0c5.tar.gz linux-stable-b545dc9debe69ca513b93f4a244451e9be14b0c5.tar.bz2 linux-stable-b545dc9debe69ca513b93f4a244451e9be14b0c5.zip |
HID: hiddev: do cleanup in failure of opening a device
commit 6d4472d7bec39917b54e4e80245784ea5d60ce49 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hid')
-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 56da33bc3862..5a949ca42b1d 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -321,6 +321,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); |