The patch number 11231 was added via Janne Grunau <[email protected]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        Linux Media Mailing List <[email protected]>

------

From: Janne Grunau  <[email protected]>
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.

Priority: normal

Signed-off-by: Janne Grunau <[email protected]>


---

 linux/drivers/media/video/hdpvr/hdpvr-core.c  |    2 ++
 linux/drivers/media/video/hdpvr/hdpvr-video.c |    4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff -r 0b8aca6edeb3 -r c137d1fbfbdf 
linux/drivers/media/video/hdpvr/hdpvr-core.c
--- a/linux/drivers/media/video/hdpvr/hdpvr-core.c      Thu Mar 26 18:32:54 
2009 +0100
+++ b/linux/drivers/media/video/hdpvr/hdpvr-core.c      Fri Mar 27 00:56:06 
2009 +0100
@@ -390,8 +390,10 @@ static void hdpvr_disconnect(struct usb_
        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 -r 0b8aca6edeb3 -r c137d1fbfbdf 
linux/drivers/media/video/hdpvr/hdpvr-video.c
--- a/linux/drivers/media/video/hdpvr/hdpvr-video.c     Thu Mar 26 18:32:54 
2009 +0100
+++ b/linux/drivers/media/video/hdpvr/hdpvr-video.c     Fri Mar 27 00:56:06 
2009 +0100
@@ -300,12 +300,14 @@ static int hdpvr_stop_streaming(struct h
 
        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 fil
        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;


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/c137d1fbfbdf77e697126bbb45a4d49659f981ea

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to