diff options
author | Chris Rankin <rankincj@yahoo.com> | 2011-09-24 15:54:58 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-09-25 08:47:59 -0400 |
commit | b868a537b675eed2ba84bbeca4c8557ebf9e0156 (patch) | |
tree | 42a7bd386be97907cbbc3243d5c2cdc3fc0bb2a1 | |
parent | 4a6c4a9567aed23cf7e8134c63f3176a57e5572b (diff) |
[media] em28xx: fix deadlock when unplugging and replugging a DVB adapter
This fixes the deadlock that occurs with either multiple PCTV 290e adapters or when a single PCTV 290e adapter is replugged.
For DVB devices, the device lock must now *not* be held when adding/removing either a device or an extension to the respective lists. (Because em28xx_init_dvb() will want to take the lock instead).
Conversely, for Audio-Only devices, the device lock *must* be held when adding/removing either a device or an extension to the respective lists.
Signed-off-by: Chris Rankin <rankincj@yahoo.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 7297d909fb6b..2e1c1214c38f 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -3005,7 +3005,9 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
3005 | goto fail; | 3005 | goto fail; |
3006 | } | 3006 | } |
3007 | 3007 | ||
3008 | mutex_unlock(&dev->lock); | ||
3008 | em28xx_init_extension(dev); | 3009 | em28xx_init_extension(dev); |
3010 | mutex_lock(&dev->lock); | ||
3009 | 3011 | ||
3010 | /* Save some power by putting tuner to sleep */ | 3012 | /* Save some power by putting tuner to sleep */ |
3011 | v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0); | 3013 | v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0); |
@@ -3301,10 +3303,10 @@ static void em28xx_usb_disconnect(struct usb_interface *interface) | |||
3301 | em28xx_release_resources(dev); | 3303 | em28xx_release_resources(dev); |
3302 | } | 3304 | } |
3303 | 3305 | ||
3304 | em28xx_close_extension(dev); | ||
3305 | |||
3306 | mutex_unlock(&dev->lock); | 3306 | mutex_unlock(&dev->lock); |
3307 | 3307 | ||
3308 | em28xx_close_extension(dev); | ||
3309 | |||
3308 | if (!dev->users) { | 3310 | if (!dev->users) { |
3309 | kfree(dev->alt_max_pkt_size); | 3311 | kfree(dev->alt_max_pkt_size); |
3310 | kfree(dev); | 3312 | kfree(dev); |