aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/hdpvr
diff options
context:
space:
mode:
authorJanne Grunau <j@jannau.net>2009-03-26 19:56:06 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:42 -0400
commit48f98f7557d35d360470bf6d9fd7b00d04fba828 (patch)
tree8231070b0a8fce217cc061ac50979afd1ef72294 /drivers/media/video/hdpvr
parentd2ff3ec81628cbf9470c496b3d0c0780165643f5 (diff)
V4L/DVB (11231): hdpvr: locking fixes
unlock io_mutex in hdpvr_stop_streaming hdpvr_disconnect to allow the streaming worker to stop before we flush the workqueue. do not return to user space with mutex held in vidioc_encoder_cmd with an unknown encoder command. Signed-off-by: Janne Grunau <j@jannau.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/hdpvr')
-rw-r--r--drivers/media/video/hdpvr/hdpvr-core.c2
-rw-r--r--drivers/media/video/hdpvr/hdpvr-video.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/video/hdpvr/hdpvr-core.c b/drivers/media/video/hdpvr/hdpvr-core.c
index 2c49862b6d32..547833eb6cec 100644
--- a/drivers/media/video/hdpvr/hdpvr-core.c
+++ b/drivers/media/video/hdpvr/hdpvr-core.c
@@ -390,8 +390,10 @@ static void hdpvr_disconnect(struct usb_interface *interface)
390 video_unregister_device(dev->video_dev); 390 video_unregister_device(dev->video_dev);
391 wake_up_interruptible(&dev->wait_data); 391 wake_up_interruptible(&dev->wait_data);
392 wake_up_interruptible(&dev->wait_buffer); 392 wake_up_interruptible(&dev->wait_buffer);
393 mutex_unlock(&dev->io_mutex);
393 msleep(100); 394 msleep(100);
394 flush_workqueue(dev->workqueue); 395 flush_workqueue(dev->workqueue);
396 mutex_lock(&dev->io_mutex);
395 hdpvr_cancel_queue(dev); 397 hdpvr_cancel_queue(dev);
396 destroy_workqueue(dev->workqueue); 398 destroy_workqueue(dev->workqueue);
397 mutex_unlock(&dev->io_mutex); 399 mutex_unlock(&dev->io_mutex);
diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c
index e9078cdedb28..2fe57303c0b5 100644
--- a/drivers/media/video/hdpvr/hdpvr-video.c
+++ b/drivers/media/video/hdpvr/hdpvr-video.c
@@ -300,12 +300,14 @@ static int hdpvr_stop_streaming(struct hdpvr_device *dev)
300 300
301 dev->status = STATUS_SHUTTING_DOWN; 301 dev->status = STATUS_SHUTTING_DOWN;
302 hdpvr_config_call(dev, CTRL_STOP_STREAMING_VALUE, 0x00); 302 hdpvr_config_call(dev, CTRL_STOP_STREAMING_VALUE, 0x00);
303 mutex_unlock(&dev->io_mutex);
303 304
304 wake_up_interruptible(&dev->wait_buffer); 305 wake_up_interruptible(&dev->wait_buffer);
305 msleep(50); 306 msleep(50);
306 307
307 flush_workqueue(dev->workqueue); 308 flush_workqueue(dev->workqueue);
308 309
310 mutex_lock(&dev->io_mutex);
309 /* kill the still outstanding urbs */ 311 /* kill the still outstanding urbs */
310 hdpvr_cancel_queue(dev); 312 hdpvr_cancel_queue(dev);
311 313
@@ -1130,7 +1132,7 @@ static int vidioc_encoder_cmd(struct file *filp, void *priv,
1130 default: 1132 default:
1131 v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev, 1133 v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev,
1132 "Unsupported encoder cmd %d\n", a->cmd); 1134 "Unsupported encoder cmd %d\n", a->cmd);
1133 return -EINVAL; 1135 res = -EINVAL;
1134 } 1136 }
1135 mutex_unlock(&dev->io_mutex); 1137 mutex_unlock(&dev->io_mutex);
1136 return res; 1138 return res;