]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/media/v4l2-fh.h
media: v4l: event: Prevent freeing event subscriptions while accessed
[linux.git] / include / media / v4l2-fh.h
index ea73fef8bdc021b48e68b4b4ce8bb7fe7fc44b57..8586cfb498286ce4399487f4f4627ff2a0b16e9f 100644 (file)
@@ -38,10 +38,13 @@ struct v4l2_ctrl_handler;
  * @prio: priority of the file handler, as defined by &enum v4l2_priority
  *
  * @wait: event' s wait queue
+ * @subscribe_lock: serialise changes to the subscribed list; guarantee that
+ *                 the add and del event callbacks are orderly called
  * @subscribed: list of subscribed events
  * @available: list of events waiting to be dequeued
  * @navailable: number of available events at @available list
  * @sequence: event sequence number
+ *
  * @m2m_ctx: pointer to &struct v4l2_m2m_ctx
  */
 struct v4l2_fh {
@@ -52,6 +55,7 @@ struct v4l2_fh {
 
        /* Events */
        wait_queue_head_t       wait;
+       struct mutex            subscribe_lock;
        struct list_head        subscribed;
        struct list_head        available;
        unsigned int            navailable;