]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
HID: i2c-hid: fix race condition reading reports
authorJean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Wed, 19 Nov 2014 16:46:37 +0000 (00:46 +0800)
committerJiri Kosina <jkosina@suse.cz>
Tue, 25 Nov 2014 14:24:54 +0000 (15:24 +0100)
commit6296f4a8eb86f9abcc370fb7a1a116b8441c17fd
treebea704c7efa5eda1c5ca33271b44e7a4d34df272
parent08bb7beae7fe102939fe5931222fc09e10d27cda
HID: i2c-hid: fix race condition reading reports

Current driver uses a common buffer for reading reports either
synchronously in i2c_hid_get_raw_report() and asynchronously in
the interrupt handler.
There is race condition if an interrupt arrives immediately after
the report is received in i2c_hid_get_raw_report(); the common
buffer is modified by the interrupt handler with the new report
and then i2c_hid_get_raw_report() proceed using wrong data.

Fix it by using a separate buffers for synchronous reports.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
[Antonio Borneo: cleanup, rebase to v3.17, submit mainline]
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/i2c-hid/i2c-hid.c