提交 6d4472d7 编写于 作者: H Hillf Danton 提交者: Jiri Kosina

HID: hiddev: do cleanup in failure of opening a device

Undo what we did for opening before releasing the memory slice.
Reported-by: Nsyzbot <syzbot+62a1e04fd3ec2abf099e@syzkaller.appspotmail.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: NHillf Danton <hdanton@sina.com>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 9c09b214
......@@ -308,6 +308,10 @@ static int hiddev_open(struct inode *inode, struct file *file)
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册