diff options
author | Janne Grunau <j@jannau.net> | 2009-03-27 00:56:06 +0100 |
---|---|---|
committer | Janne Grunau <j@jannau.net> | 2009-03-27 00:56:06 +0100 |
commit | fcf939c56e5b32cbd2f6e77d9de6d190186a4c1a (patch) | |
tree | cb8e33117ec2b7f1be7f67b8bc240a0848599231 /linux/drivers/media | |
parent | 3d73a21a3b0fb96a08c796016ae66cb734327490 (diff) | |
download | mediapointer-dvb-s2-fcf939c56e5b32cbd2f6e77d9de6d190186a4c1a.tar.gz mediapointer-dvb-s2-fcf939c56e5b32cbd2f6e77d9de6d190186a4c1a.tar.bz2 |
hdpvr: locking fixes
From: Janne Grunau <j@jannau.net>
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.
Priority: normal
Signed-off-by: Janne Grunau <j@jannau.net>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/video/hdpvr/hdpvr-core.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/hdpvr/hdpvr-video.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/linux/drivers/media/video/hdpvr/hdpvr-core.c b/linux/drivers/media/video/hdpvr/hdpvr-core.c index 2c49862b6..547833eb6 100644 --- a/linux/drivers/media/video/hdpvr/hdpvr-core.c +++ b/linux/drivers/media/video/hdpvr/hdpvr-core.c @@ -390,8 +390,10 @@ static void hdpvr_disconnect(struct usb_interface *interface) video_unregister_device(dev->video_dev); wake_up_interruptible(&dev->wait_data); wake_up_interruptible(&dev->wait_buffer); + mutex_unlock(&dev->io_mutex); msleep(100); flush_workqueue(dev->workqueue); + mutex_lock(&dev->io_mutex); hdpvr_cancel_queue(dev); destroy_workqueue(dev->workqueue); mutex_unlock(&dev->io_mutex); diff --git a/linux/drivers/media/video/hdpvr/hdpvr-video.c b/linux/drivers/media/video/hdpvr/hdpvr-video.c index e9078cded..2fe57303c 100644 --- a/linux/drivers/media/video/hdpvr/hdpvr-video.c +++ b/linux/drivers/media/video/hdpvr/hdpvr-video.c @@ -300,12 +300,14 @@ static int hdpvr_stop_streaming(struct hdpvr_device *dev) dev->status = STATUS_SHUTTING_DOWN; hdpvr_config_call(dev, CTRL_STOP_STREAMING_VALUE, 0x00); + mutex_unlock(&dev->io_mutex); wake_up_interruptible(&dev->wait_buffer); msleep(50); flush_workqueue(dev->workqueue); + mutex_lock(&dev->io_mutex); /* kill the still outstanding urbs */ hdpvr_cancel_queue(dev); @@ -1130,7 +1132,7 @@ static int vidioc_encoder_cmd(struct file *filp, void *priv, default: v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev, "Unsupported encoder cmd %d\n", a->cmd); - return -EINVAL; + res = -EINVAL; } mutex_unlock(&dev->io_mutex); return res; |