diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-14 01:31:15 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-14 01:31:15 +0000 |
commit | fe6c63a6af78ccde86f29207003db1c897e7a8c4 (patch) | |
tree | 8caab0e38875d9e1ebb4657fda3579c0e3dc91e3 /linux | |
parent | a6cca35edd4cdcab3bcbfc3f3aca5dbdc7bc9f3e (diff) | |
download | mediapointer-dvb-s2-fe6c63a6af78ccde86f29207003db1c897e7a8c4.tar.gz mediapointer-dvb-s2-fe6c63a6af78ccde86f29207003db1c897e7a8c4.tar.bz2 |
stk-webcam: fix crash on close after disconnect
From: David Ellingsworth <david@identd.dyndns.org>
This patch prevents stk-webcam from updating usb device information
once the camera has been removed. This prevents a crash that would
otherwise occur if the camera is disconnected while it is still in
use.
Signed-off-by: David Ellingsworth <david@identd.dyndns.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/video/stk-webcam.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/linux/drivers/media/video/stk-webcam.c b/linux/drivers/media/video/stk-webcam.c index 11451518c..f606300e8 100644 --- a/linux/drivers/media/video/stk-webcam.c +++ b/linux/drivers/media/video/stk-webcam.c @@ -560,7 +560,7 @@ static void stk_clean_iso(struct stk_camera *dev) urb = dev->isobufs[i].urb; if (urb) { - if (atomic_read(&dev->urbs_used)) + if (atomic_read(&dev->urbs_used) && is_present(dev)) usb_kill_urb(urb); usb_free_urb(urb); } @@ -689,18 +689,14 @@ static int v4l_stk_release(struct inode *inode, struct file *fp) { struct stk_camera *dev = fp->private_data; - if (dev->owner != fp) { - usb_autopm_put_interface(dev->interface); - return 0; + if (dev->owner == fp) { + stk_stop_stream(dev); + stk_free_buffers(dev); + dev->owner = NULL; } - stk_stop_stream(dev); - - stk_free_buffers(dev); - - dev->owner = NULL; - - usb_autopm_put_interface(dev->interface); + if(is_present(dev)) + usb_autopm_put_interface(dev->interface); return 0; } |