Files
linux/drivers
Sakari Ailus d61ba3417e media: v4l: event: Prevent freeing event subscriptions while accessed
commit ad608fbcf1 upstream.

The event subscriptions are added to the subscribed event list while
holding a spinlock, but that lock is subsequently released while still
accessing the subscription object. This makes it possible to unsubscribe
the event --- and freeing the subscription object's memory --- while
the subscription object is simultaneously accessed.

Prevent this by adding a mutex to serialise the event subscription and
unsubscription. This also gives a guarantee to the callback ops that the
add op has returned before the del op is called.

This change also results in making the elems field less special:
subscriptions are only added to the event list once they are fully
initialised.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: stable@vger.kernel.org # for 4.14 and up
Fixes: c3b5b0241f ("V4L/DVB: V4L: Events: Add backend")
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-03 17:01:00 -07:00
..
2018-10-03 17:00:59 -07:00
2018-07-22 14:28:43 +02:00
2018-07-03 11:24:56 +02:00
2018-08-22 07:46:11 +02:00
2018-01-17 09:45:27 +01:00
2018-08-24 13:09:06 +02:00
2018-07-25 11:25:10 +02:00
2018-09-15 09:45:27 +02:00
2018-10-03 17:00:46 -07:00