]> git.ipfire.org Git - thirdparty/kernel/stable.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 Slaby <jslaby@suse.cz>
Mon, 26 Jan 2015 13:38:48 +0000 (14:38 +0100)
commit5927cd034b1a289e1c73018fc908403c0ce15658
tree89533e7a1b7cc07e6433fc710d5980aca27fbfdf
parentb377e72cf3c79fcba0fad4b0925fde850d353a15
HID: i2c-hid: fix race condition reading reports

commit 6296f4a8eb86f9abcc370fb7a1a116b8441c17fd upstream.

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>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/hid/i2c-hid/i2c-hid.c