HID: protect hid_debug_list

Accesses to hid_device->hid_debug_list are not serialized properly, which
could result in SMP concurrency issues when HID debugfs events are accessesed
by multiple userspace processess.

Serialize all the list operations by a mutex.

Spotted by Al Viro.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
Jiri Kosina
2013-04-16 15:40:09 -07:00
parent a5f04b9df1
commit 2353f2bea3
3 changed files with 8 additions and 0 deletions

View File

@@ -512,6 +512,7 @@ struct hid_device { /* device report descriptor */
struct dentry *debug_rdesc;
struct dentry *debug_events;
struct list_head debug_list;
struct mutex debug_list_lock;
wait_queue_head_t debug_wait;
};