mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-26 18:43:33 -05:00
HID: hidraw: fix improper mutex release
Mutex can not be released unless all hid_device members are properly initialized. Otherwise it would result in a race condition that can cause NULL pointer kernel panic issue in hidraw_open where it uses uninitialized 'list' member in list_add_tail(). Signed-off-by: Yonghua Zheng <younghua.zheng@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
6f49801827
commit
8e552e5359
1 changed files with 1 additions and 1 deletions
|
@ -518,7 +518,6 @@ int hidraw_connect(struct hid_device *hid)
|
|||
goto out;
|
||||
}
|
||||
|
||||
mutex_unlock(&minors_lock);
|
||||
init_waitqueue_head(&dev->wait);
|
||||
INIT_LIST_HEAD(&dev->list);
|
||||
|
||||
|
@ -528,6 +527,7 @@ int hidraw_connect(struct hid_device *hid)
|
|||
dev->exist = 1;
|
||||
hid->hidraw = dev;
|
||||
|
||||
mutex_unlock(&minors_lock);
|
||||
out:
|
||||
return result;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue