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:52:57 +0300 |
commit | 8e73f43b6772a262d1884511f694e0f90c3dfa68 (patch) | |
tree | fce3997448a742ac1174e3737088349955c3a122 | |
parent | 76285c83fe1b8ef8aff924e4c9897999e7874605 (diff) | |
download | linux-8e73f43b6772a262d1884511f694e0f90c3dfa68.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>
-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 0bfc2009e407..8903ea09ac58 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -330,6 +330,10 @@ static int hiddev_open(struct inode *inode, struct file *file) return 0; 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); |