android_kernel_samsung_msm8976/drivers/media/v4l2-core
Sakari Ailus 0daf8a201b media: v4l: event: Prevent freeing event subscriptions while accessed
commit ad608fbcf166fec809e402d548761768f602702c 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>
2019-07-27 21:51:55 +02:00
..
Kconfig
Makefile
tuner-core.c
v4l2-common.c
v4l2-compat-ioctl32.c media: v4l2-compat-ioctl32: don't oops on overlay 2019-07-27 21:48:43 +02:00
v4l2-ctrls.c
v4l2-dev.c
v4l2-device.c
v4l2-event.c media: v4l: event: Prevent freeing event subscriptions while accessed 2019-07-27 21:51:55 +02:00
v4l2-fh.c media: v4l: event: Prevent freeing event subscriptions while accessed 2019-07-27 21:51:55 +02:00
v4l2-int-device.c
v4l2-ioctl.c media: v4l2-ioctl.c: don't copy back the result for -ENOTTY 2019-07-27 21:46:34 +02:00
v4l2-mem2mem.c
v4l2-of.c
v4l2-subdev.c
videobuf-core.c
videobuf-dma-contig.c
videobuf-dma-sg.c
videobuf-dvb.c
videobuf-msm-mem.c
videobuf-vmalloc.c
videobuf2-core.c vb2: V4L2_BUF_FLAG_DONE is set after DQBUF 2019-07-27 21:46:35 +02:00
videobuf2-dma-contig.c media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish 2016-02-19 14:22:39 -08:00
videobuf2-dma-sg.c
videobuf2-memops.c
videobuf2-vmalloc.c