linux/drivers/media
Tomi Valkeinen adecd49745 media: ov5640: fix use of destroyed mutex
commit bfcba38d95 upstream.

v4l2_ctrl_handler_free() uses hdl->lock, which in ov5640 driver is set
to sensor's own sensor->lock. In ov5640_remove(), the driver destroys the
sensor->lock first, and then calls v4l2_ctrl_handler_free(), resulting
in the use of the destroyed mutex.

Fix this by calling moving the mutex_destroy() to the end of the cleanup
sequence, as there's no need to destroy the mutex as early as possible.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: stable@vger.kernel.org # v4.14+
Reviewed-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-22 09:31:19 +02:00
..
cec media: cec: silence shift wrapping warning in __cec_s_log_addrs() 2020-06-22 09:31:02 +02:00
common
dvb-core media: dvbdev: Fix tuner->demod media controller link 2020-06-22 09:30:55 +02:00
dvb-frontends
firewire
i2c media: ov5640: fix use of destroyed mutex 2020-06-22 09:31:19 +02:00
mc
mmc
pci
platform media: platform: fcp: Set appropriate DMA parameters 2020-06-22 09:30:59 +02:00
radio
rc media: rc: add keymap for Videostrong KII Pro 2020-04-17 10:49:59 +02:00
spi
tuners media: si2157: Better check for running tuner in init 2020-06-22 09:30:50 +02:00
usb media: go7007: fix a miss of snd_card_free 2020-06-22 09:31:18 +02:00
v4l2-core media: v4l2-core: fix a use-after-free bug of sd->devnode 2020-04-01 11:02:18 +02:00
Kconfig
Makefile