android_kernel_motorola_sm6225/drivers/media/video
Laurent Pinchart a9e2858561 V4L/DVB (8257): uvcvideo: Fix possible AB-BA deadlock with videodev_lock and open_mutex
The uvcvideo driver's uvc_v4l2_open() method is called from videodev's
video_open() function, which means it is called with the videodev_lock
mutex held.  uvc_v4l2_open() then takes uvc_driver.open_mutex to check
dev->state and avoid racing against a device disconnect, which means
that open_mutex must nest inside videodev_lock.

However uvc_disconnect() takes the open_mutex around setting
dev->state and also around putting its device reference.  However, if
uvc_disconnect() ends up dropping the last reference, it will call
uvc_delete(), which calls into the videodev code to unregister its
device, and this will end up taking videodev_lock.  This opens a
(unlikely in practice) window for an AB-BA deadlock and also causes a
lockdep warning because of the lock misordering.

Fortunately there is no apparent reason to hold open_mutex when doing
kref_put() in uvc_disconnect(): if uvc_v4l2_open() runs before the
state is set to UVC_DEV_DISCONNECTED, then it will take another
reference to the device and kref_put() won't call uvc_delete; if
uvc_v4l2_open() runs after the state is set, it will run before
uvc_delete(), see the state, and return immediately -- uvc_delete()
does uvc_unregister_video() (and hence video_unregister_device(),
which is synchronized with videodev_lock) as its first thing, so there
is no risk of use-after-free in uvc_v4l2_open().

Bug diagnosed based on a lockdep warning reported by Romano Giannetti
<romano@dea.icai.upcomillas.es>.

Signed-off-by: Roland Dreier <roland@digitalvampire.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-20 07:19:31 -03:00
..
au0828 V4L/DVB (8043): au0828: add support for additional USB device id's 2008-06-26 15:58:52 -03:00
bt8xx v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
cpia2 cpia2: use request_firmware() 2008-07-14 14:43:28 -07:00
cx18 v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
cx88 v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
cx23885 V4L/DVB (8236): cx23885: add support for new revision of FusionHDTV7 Dual Express 2008-07-20 07:18:25 -03:00
cx25840 v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
em28xx v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
et61x251 byteorder: don't directly include linux/byteorder/generic.h 2008-05-16 12:01:45 -07:00
gspca V4L/DVB (8253): gspca: fix warnings on x86_64 2008-07-20 07:19:18 -03:00
ivtv V4L/DVB (8249): Fix pointer cast warnings in the ivtv framebuffer driver 2008-07-20 07:18:58 -03:00
ovcamchip V4L/DVB (8245): ovcamchip: Delete stray I2C bus ID 2008-07-20 07:18:34 -03:00
pvrusb2 V4L/DVB (8176): pvrusb2: Update video_gop_size 2008-07-20 07:15:52 -03:00
pwc v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
saa7134 V4L/DVB (8244): saa7134: add support for AVerMedia M103 2008-07-20 07:18:29 -03:00
sn9c102 byteorder: don't directly include linux/byteorder/generic.h 2008-05-16 12:01:45 -07:00
usbvideo vicam: use request_firmware() 2008-07-14 14:44:32 -07:00
usbvision v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
uvc V4L/DVB (8257): uvcvideo: Fix possible AB-BA deadlock with videodev_lock and open_mutex 2008-07-20 07:19:31 -03:00
zc0301 byteorder: don't directly include linux/byteorder/generic.h 2008-05-16 12:01:45 -07:00
adv7170.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
adv7175.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
arv.c V4L/DVB (7402): add macro validation for v4l_compat_ioctl32 2008-04-24 14:07:53 -03:00
bt819.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
bt856.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
bt866.c V4L/DVB (6819): i2c: fix drivers/media/video/bt866.c 2007-12-13 17:58:05 -02:00
btcx-risc.c V4L/DVB (7965): annotate bcx_riscmem 2008-06-05 06:35:51 -03:00
btcx-risc.h V4L/DVB (7965): annotate bcx_riscmem 2008-06-05 06:35:51 -03:00
bw-qcam.c V4L/DVB (7402): add macro validation for v4l_compat_ioctl32 2008-04-24 14:07:53 -03:00
bw-qcam.h
c-qcam.c V4L/DVB (7591): drivers/media/video: use time_before, time_before_eq, etc 2008-04-24 14:09:40 -03:00
cafe_ccic-regs.h V4L/DVB (5690): Cafe_ccic: Properly power down the sensor 2007-05-22 16:16:27 -03:00
cafe_ccic.c V4L/DVB (7949): videodev: renamed the vidioc_*_fmt_* callbacks 2008-07-20 07:07:32 -03:00
compat_ioctl32.c V4L/DVB (7942): Hardware frequency seek ioctl interface 2008-07-20 07:07:12 -03:00
cpia.c V4L/DVB (7402): add macro validation for v4l_compat_ioctl32 2008-04-24 14:07:53 -03:00
cpia.h V4L/DVB (7518): media/video/ replace remaining __FUNCTION__ occurrences 2008-04-24 14:07:59 -03:00
cpia_pp.c
cpia_usb.c V4L/DVB (7518): media/video/ replace remaining __FUNCTION__ occurrences 2008-04-24 14:07:59 -03:00
cs53l32a.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
cs5345.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
cs8420.h
cx2341x.c V4L/DVB (8105): cx2341x: add TS capability 2008-07-20 07:11:55 -03:00
dabusb.c dabusb: use request_firmware() 2008-07-14 14:44:21 -07:00
dabusb.h
dpc7146.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
font.h
hexium_gemini.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
hexium_orion.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
ibmmpeg2.h
indycam.c drivers/media/: Spelling fixes 2008-02-03 17:18:59 +02:00
indycam.h
ir-kbd-i2c.c V4L/DVB (7751): ir-kbd-i2c: Save a temporary memory allocation in ir_probe 2008-04-26 09:29:58 -03:00
Kconfig V4L/DVB (8152): Initial release of gspca with only one driver. 2008-07-20 07:14:28 -03:00
ks0127.c i2c: Use the driver model reference counting 2008-01-27 18:14:48 +01:00
ks0127.h
m52790.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
Makefile V4L/DVB (8157): gspca: all subdrivers 2008-07-20 07:14:49 -03:00
meye.c V4L/DVB (7949): videodev: renamed the vidioc_*_fmt_* callbacks 2008-07-20 07:07:32 -03:00
meye.h Convert files to UTF-8 and some cleanups 2007-10-19 23:21:04 +02:00
msp3400-driver.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
msp3400-driver.h
msp3400-kthreads.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
mt9m001.c V4L/DVB (7858): video: build fix for drivers/media/video/mt9v022.c 2008-05-14 02:54:10 -03:00
mt9v022.c V4L/DVB (8143): Fix compilation for mt9v022 2008-07-20 07:14:00 -03:00
mxb.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
mxb.h
ov511.c V4L/DVB (7641): V4L: ov511 - use usb_interface as parent, not usb_device 2008-04-24 14:09:44 -03:00
ov511.h V4L/DVB (7518): media/video/ replace remaining __FUNCTION__ occurrences 2008-04-24 14:07:59 -03:00
ov7670.c ov7670: clean up ov7670_read semantics 2008-07-12 14:33:41 -07:00
planb.c V4L/DVB (6407): planb: fix obvious interrupt handling bugs 2007-11-04 21:41:20 -02:00
planb.h
pms.c V4L/DVB (7402): add macro validation for v4l_compat_ioctl32 2008-04-24 14:07:53 -03:00
pxa_camera.c V4L/DVB (8039): pxa-camera: fix platform_get_irq() error handling. 2008-06-26 15:58:50 -03:00
s2255drv.c V4L/DVB (8125): This driver adds support for the Sensoray 2255 devices. 2008-07-20 07:12:59 -03:00
saa711x_regs.h
saa717x.c i2c: Convert remaining new-style drivers to use module aliasing 2008-05-18 20:49:40 +02:00
saa5246a.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
saa5246a.h
saa5249.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
saa6588.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
saa7110.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
saa7111.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
saa7114.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
saa7115.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
saa7121.h
saa7127.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
saa7146.h
saa7146reg.h
saa7185.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
saa7191.c V4L/DVB (6148): Fix a warning at saa7191_probe 2007-09-14 13:13:42 -03:00
saa7191.h
saa7196.h
se401.c V4L/DVB (7518): media/video/ replace remaining __FUNCTION__ occurrences 2008-04-24 14:07:59 -03:00
se401.h
soc_camera.c V4L/DVB (7988): soc_camera: missed fmt callback conversion. 2008-07-20 07:08:14 -03:00
stk-sensor.c V4L/DVB (7104): stk-sensor.c: make 2 functions static 2008-02-18 11:15:08 -03:00
stk-webcam.c V4L/DVB (7949): videodev: renamed the vidioc_*_fmt_* callbacks 2008-07-20 07:07:32 -03:00
stk-webcam.h V4L/DVB (7104): stk-sensor.c: make 2 functions static 2008-02-18 11:15:08 -03:00
stradis.c V4L/DVB (7402): add macro validation for v4l_compat_ioctl32 2008-04-24 14:07:53 -03:00
stv680.c V4L/DVB (7518): media/video/ replace remaining __FUNCTION__ occurrences 2008-04-24 14:07:59 -03:00
stv680.h
tcm825x.c V4L/DVB (7897): TCM825x: Include invertation of image mirroring in configuration 2008-07-20 07:06:01 -03:00
tcm825x.h V4L/DVB (7897): TCM825x: Include invertation of image mirroring in configuration 2008-07-20 07:06:01 -03:00
tda7432.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
tda9840.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
tda9840.h
tda9875.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
tea6415c.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
tea6415c.h
tea6420.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
tea6420.h
tlv320aic23b.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
tuner-3036.c
tuner-core.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
tvaudio.c V4L/DVB (8246): tvaudio: Stop I2C driver ID abuse 2008-07-20 07:18:38 -03:00
tveeprom.c V4L/DVB (7895): tveeprom: update Hauppauge analog audio and video decoders 2008-05-14 02:56:46 -03:00
tvp5150.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
tvp5150_reg.h
upd64031a.c i2c: Convert remaining new-style drivers to use module aliasing 2008-05-18 20:49:40 +02:00
upd64083.c i2c: Convert remaining new-style drivers to use module aliasing 2008-05-18 20:49:40 +02:00
v4l1-compat.c V4L/DVB (7365): reduce stack usage of v4l1_compat_sync 2008-04-24 14:07:50 -03:00
v4l2-common.c i2c: Add support for device alias names 2008-04-29 23:11:39 +02:00
v4l2-int-device.c V4L/DVB (7485): v4l2-int-device.c: add MODULE_LICENSE 2008-04-01 19:35:47 -03:00
videobuf-core.c Fix a deadlock in the bttv driver 2008-05-20 10:12:26 -07:00
videobuf-dma-sg.c V4L/DVB (8252): buf-dma-sg.c: avoid clearing memory twice 2008-07-20 07:19:10 -03:00
videobuf-dvb.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
videobuf-vmalloc.c V4L/DVB (7566): videobuf-dvb: allow its usage with videobuf-vmalloc 2008-04-24 14:09:39 -03:00
videocodec.c V4L/DVB (7580): Fix concurrent read from /proc/videocodecs 2008-04-24 14:09:40 -03:00
videocodec.h
videodev.c V4L/DVB (8116): videodev: allow PRIVATE_BASE controls when called through VIDIOC_G/S_CTRL. 2008-07-20 07:12:33 -03:00
vino.c mm: remove nopage 2008-04-28 08:58:18 -07:00
vino.h
vivi.c V4L/DVB (8024): vivi: rename MODULE_NAME macro to VIVI_MODULE_NAME to avoid namespace conflicts 2008-07-20 07:09:18 -03:00
vp27smpx.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
vpx3220.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
w9966.c V4L/DVB (7518): media/video/ replace remaining __FUNCTION__ occurrences 2008-04-24 14:07:59 -03:00
w9968cf.c V4L/DVB (7402): add macro validation for v4l_compat_ioctl32 2008-04-24 14:07:53 -03:00
w9968cf.h V4L/DVB (7518): media/video/ replace remaining __FUNCTION__ occurrences 2008-04-24 14:07:59 -03:00
w9968cf_decoder.h
w9968cf_vpp.h
wm8739.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
wm8775.c v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10 2008-07-20 07:17:52 -03:00
zoran.h V4L/DVB (7968): zoran: endianness annotations 2008-06-05 06:35:52 -03:00
zoran_card.c V4L/DVB (8134): zoran annotations and fixes 2008-07-20 07:13:39 -03:00
zoran_card.h V4L/DVB (7479): proper prototype for zoran_device.c:zr36016_write() 2008-04-24 14:07:57 -03:00
zoran_device.c V4L/DVB (7968): zoran: endianness annotations 2008-06-05 06:35:52 -03:00
zoran_device.h
zoran_driver.c V4L/DVB (8134): zoran annotations and fixes 2008-07-20 07:13:39 -03:00
zoran_procfs.c drivers: use non-racy method for proc entries creation (2) 2008-04-29 08:06:22 -07:00
zoran_procfs.h
zr364xx.c V4L/DVB (7949): videodev: renamed the vidioc_*_fmt_* callbacks 2008-07-20 07:07:32 -03:00
zr36016.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
zr36016.h
zr36050.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
zr36050.h
zr36057.h
zr36060.c V4L/DVB (7094): static memory 2008-04-24 13:42:20 -03:00
zr36060.h