Skip to content

Commit 6d4472d

Browse files
Hillf DantonJiri Kosina
authored andcommitted
HID: hiddev: do cleanup in failure of opening a device
Undo what we did for opening before releasing the memory slice. Reported-by: syzbot <[email protected]> Cc: Andrey Konovalov <[email protected]> Signed-off-by: Hillf Danton <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 9c09b21 commit 6d4472d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/hid/usbhid/hiddev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ static int hiddev_open(struct inode *inode, struct file *file)
308308
hid_hw_power(hid, PM_HINT_NORMAL);
309309
bail_unlock:
310310
mutex_unlock(&hiddev->existancelock);
311+
312+
spin_lock_irq(&list->hiddev->list_lock);
313+
list_del(&list->node);
314+
spin_unlock_irq(&list->hiddev->list_lock);
311315
bail:
312316
file->private_data = NULL;
313317
vfree(list);

0 commit comments

Comments
 (0)