summaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/rc-core-priv.h
diff options
context:
space:
mode:
authorSean Young2018-02-14 16:26:17 +0100
committerMauro Carvalho Chehab2018-02-27 14:16:09 +0100
commite3e389f931a14ddf43089c7db92fc5d74edf93a4 (patch)
treef86b1de14994ef7aab7962abc89babb75580d184 /drivers/media/rc/rc-core-priv.h
parentmedia: rc: no need to announce major number (diff)
downloadkernel-qcow2-linux-e3e389f931a14ddf43089c7db92fc5d74edf93a4.tar.gz
kernel-qcow2-linux-e3e389f931a14ddf43089c7db92fc5d74edf93a4.tar.xz
kernel-qcow2-linux-e3e389f931a14ddf43089c7db92fc5d74edf93a4.zip
media: rc: fix race condition in ir_raw_event_store_edge() handling
There is a possible race condition between the IR timeout being generated from the timer, and new IR arriving. This could result in the timeout being added to the kfifo after new IR arrives. On top of that, there is concurrent write access to the kfifo from ir_raw_event_store_edge() and the timer. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/rc/rc-core-priv.h')
-rw-r--r--drivers/media/rc/rc-core-priv.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
index d09a06e1c17f..5e80b4273e2d 100644
--- a/drivers/media/rc/rc-core-priv.h
+++ b/drivers/media/rc/rc-core-priv.h
@@ -50,8 +50,9 @@ struct ir_raw_event_ctrl {
DECLARE_KFIFO(kfifo, struct ir_raw_event, MAX_IR_EVENT_SIZE);
ktime_t last_event; /* when last event occurred */
struct rc_dev *dev; /* pointer to the parent rc_dev */
- /* edge driver */
- struct timer_list edge_handle;
+ /* handle delayed ir_raw_event_store_edge processing */
+ spinlock_t edge_spinlock;
+ struct timer_list edge_handle;
/* raw decoder state follows */
struct ir_raw_event prev_ev;