diff options
author | Hillf Danton <hdanton@sina.com> | 2019-08-06 11:40:15 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-08-25 11:50:07 +0300 |
commit | d65ca54d05c209571cf2b3913277f75ab477e214 (patch) | |
tree | 6a2416a8ec3d5d4dfdeb01a0a4d71c6d22d12b69 /drivers/hid | |
parent | 4239114d88c9e017139d54c744065842d8271dff (diff) | |
download | linux-d65ca54d05c209571cf2b3913277f75ab477e214.tar.xz |
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 5e1361dfb61c..ce342fd0457e 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); |