linux-stable/drivers/media
Sakari Ailus ad608fbcf1 media: v4l: event: Prevent freeing event subscriptions while accessed
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>
2018-10-03 06:32:51 -04:00
..
cec - New Drivers 2018-08-20 15:38:44 -07:00
common media updates for v4.19-rc1 2018-08-15 18:29:14 -07:00
dvb-core media: dvb_frontend: ensure that the step is ok for both FE and tuner 2018-08-02 18:11:46 -04:00
dvb-frontends Merge branch 'i2c/for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2018-08-21 17:40:46 -07:00
firewire media: dvb: represent min/max/step/tolerance freqs in Hz 2018-08-02 18:10:48 -04:00
i2c media: i2c: mt9v111: Fix v4l2-ctrl error handling 2018-09-12 06:44:01 -04:00
mmc media: siano: use GFP_DMA only for smssdio 2018-05-15 08:04:42 -04:00
pci media: saa7164: fix return codes for the polling routine 2018-08-08 10:57:14 -04:00
platform media: platform: fix cros-ec-cec build error 2018-09-17 14:32:29 -04:00
radio media: radio-wl1273: fix return code for the polling routine 2018-08-08 10:57:14 -04:00
rc Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2018-08-07 11:02:05 -07:00
spi media: cxd2880-spi: Modified how to declare structure 2018-05-05 10:37:12 -04:00
tuners Merge branch 'i2c/for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2018-08-21 17:40:46 -07:00
usb media: af9035: prevent buffer overflow on write 2018-08-29 13:54:37 -04:00
v4l2-core media: v4l: event: Prevent freeing event subscriptions while accessed 2018-10-03 06:32:51 -04:00
Kconfig media: cec: Kconfig coding style issue 2018-05-09 16:26:50 -04:00
Makefile
media-device.c Merge branch 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax 2018-08-26 11:48:42 -07:00
media-devnode.c MAINTAINERS & files: Canonize the e-mails I use at files 2018-05-04 06:21:06 -04:00
media-entity.c media: media.h: reorganize header to make it easier to understand 2018-02-26 10:14:46 -05:00