提交 eda9f752 编写于 作者: S Simon Arlott 提交者: Mauro Carvalho Chehab

V4L/DVB (11841): core: fix potential mutex_unlock without mutex_lock in dvb_dvr_read

dvb_dvr_read may unlock the dmxdev mutex and return -ENODEV, except this
function is a file op and will never be called with the mutex held.

There's existing mutex_lock and mutex_unlock around the actual read but
it's commented out.  These should probably be uncommented but the read
blocks and this could block another non-blocking reader on the mutex
instead.

This change comments out the extra mutex_unlock.

[akpm@linux-foundation.org: cleanups, simplification]
Signed-off-by: NSimon Arlott <simon@fire.lp0.eu>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 1010ed13
...@@ -244,19 +244,13 @@ static ssize_t dvb_dvr_read(struct file *file, char __user *buf, size_t count, ...@@ -244,19 +244,13 @@ static ssize_t dvb_dvr_read(struct file *file, char __user *buf, size_t count,
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
struct dmxdev *dmxdev = dvbdev->priv; struct dmxdev *dmxdev = dvbdev->priv;
int ret;
if (dmxdev->exit) { if (dmxdev->exit)
mutex_unlock(&dmxdev->mutex);
return -ENODEV; return -ENODEV;
}
//mutex_lock(&dmxdev->mutex); return dvb_dmxdev_buffer_read(&dmxdev->dvr_buffer,
ret = dvb_dmxdev_buffer_read(&dmxdev->dvr_buffer,
file->f_flags & O_NONBLOCK, file->f_flags & O_NONBLOCK,
buf, count, ppos); buf, count, ppos);
//mutex_unlock(&dmxdev->mutex);
return ret;
} }
static int dvb_dvr_set_buffer_size(struct dmxdev *dmxdev, static int dvb_dvr_set_buffer_size(struct dmxdev *dmxdev,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册