mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-03-22 03:21:34 +07:00
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>
This commit is contained in:
parent
d2ff3ec816
commit
48f98f7557
drivers/media/video/hdpvr
@ -390,8 +390,10 @@ static void hdpvr_disconnect(struct usb_interface *interface)
|
|||||||
video_unregister_device(dev->video_dev);
|
video_unregister_device(dev->video_dev);
|
||||||
wake_up_interruptible(&dev->wait_data);
|
wake_up_interruptible(&dev->wait_data);
|
||||||
wake_up_interruptible(&dev->wait_buffer);
|
wake_up_interruptible(&dev->wait_buffer);
|
||||||
|
mutex_unlock(&dev->io_mutex);
|
||||||
msleep(100);
|
msleep(100);
|
||||||
flush_workqueue(dev->workqueue);
|
flush_workqueue(dev->workqueue);
|
||||||
|
mutex_lock(&dev->io_mutex);
|
||||||
hdpvr_cancel_queue(dev);
|
hdpvr_cancel_queue(dev);
|
||||||
destroy_workqueue(dev->workqueue);
|
destroy_workqueue(dev->workqueue);
|
||||||
mutex_unlock(&dev->io_mutex);
|
mutex_unlock(&dev->io_mutex);
|
||||||
|
@ -300,12 +300,14 @@ static int hdpvr_stop_streaming(struct hdpvr_device *dev)
|
|||||||
|
|
||||||
dev->status = STATUS_SHUTTING_DOWN;
|
dev->status = STATUS_SHUTTING_DOWN;
|
||||||
hdpvr_config_call(dev, CTRL_STOP_STREAMING_VALUE, 0x00);
|
hdpvr_config_call(dev, CTRL_STOP_STREAMING_VALUE, 0x00);
|
||||||
|
mutex_unlock(&dev->io_mutex);
|
||||||
|
|
||||||
wake_up_interruptible(&dev->wait_buffer);
|
wake_up_interruptible(&dev->wait_buffer);
|
||||||
msleep(50);
|
msleep(50);
|
||||||
|
|
||||||
flush_workqueue(dev->workqueue);
|
flush_workqueue(dev->workqueue);
|
||||||
|
|
||||||
|
mutex_lock(&dev->io_mutex);
|
||||||
/* kill the still outstanding urbs */
|
/* kill the still outstanding urbs */
|
||||||
hdpvr_cancel_queue(dev);
|
hdpvr_cancel_queue(dev);
|
||||||
|
|
||||||
@ -1130,7 +1132,7 @@ static int vidioc_encoder_cmd(struct file *filp, void *priv,
|
|||||||
default:
|
default:
|
||||||
v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev,
|
v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev,
|
||||||
"Unsupported encoder cmd %d\n", a->cmd);
|
"Unsupported encoder cmd %d\n", a->cmd);
|
||||||
return -EINVAL;
|
res = -EINVAL;
|
||||||
}
|
}
|
||||||
mutex_unlock(&dev->io_mutex);
|
mutex_unlock(&dev->io_mutex);
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
Reference in New Issue
Block a user