aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hidraw.h
diff options
context:
space:
mode:
authorYonghua Zheng <younghua.zheng@gmail.com>2013-08-26 23:38:35 +0800
committerJiri Kosina <jkosina@suse.cz>2013-08-26 21:40:24 +0200
commit277fe44dd862412ee034470ad1c13a79d24e533b (patch)
tree7333fed46331fc756cfde7dfd58a1127de97955b /include/linux/hidraw.h
parentHID: Fix Speedlink VAD Cezanne support for some devices (diff)
downloadlinux-dev-277fe44dd862412ee034470ad1c13a79d24e533b.tar.xz
linux-dev-277fe44dd862412ee034470ad1c13a79d24e533b.zip
HID: hidraw: Add spinlock in struct hidraw to protect list
It is unsafe to call list_for_each_entry in hidraw_report_event to traverse each hidraw_list node without a lock protection, the list could be modified if someone calls hidraw_release and list_del to remove itself from the list, this can cause hidraw_report_event to touch a deleted list struct and panic. To prevent this, introduce a spinlock in struct hidraw to protect list from concurrent access. Signed-off-by: Yonghua Zheng <younghua.zheng@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'include/linux/hidraw.h')
-rw-r--r--include/linux/hidraw.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h
index 2451662c728a..ddf52612eed8 100644
--- a/include/linux/hidraw.h
+++ b/include/linux/hidraw.h
@@ -23,6 +23,7 @@ struct hidraw {
wait_queue_head_t wait;
struct hid_device *hid;
struct device *dev;
+ spinlock_t list_lock;
struct list_head list;
};