android_kernel_samsung_msm8976/drivers/media
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
..
common
dvb-core This is the 3.10.99 stable release 2017-04-18 17:17:46 +02:00
dvb-frontends tda1004x: only update the frontend properties if locked 2016-03-03 15:06:23 -08:00
firewire
i2c
mmc
parport
pci This is the 3.10.102 stable release 2017-04-18 17:22:08 +02:00
platform msm: vidc: pm qos stability fixes for video driver. 2019-07-27 21:51:13 +02:00
radio Merge tag 'LA.BR.1.3.6-04010-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD 2017-06-09 23:21:11 +02:00
rc ir-core: fix gcc-7 warning on bool arithmetic 2019-07-27 21:44:38 +02:00
tuners xc2028: Fix use-after-free bug properly 2019-07-27 21:43:23 +02:00
usb siano: make it work again with CONFIG_VMAP_STACK 2019-07-27 21:43:54 +02:00
v4l2-core media: v4l: event: Prevent freeing event subscriptions while accessed 2019-07-27 21:51:55 +02:00
Kconfig
Makefile
media-device.c
media-devnode.c
media-entity.c