[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-dvb
Subject:    [linux-dvb] [PATCH] dvb-core: Fix potential mutex_unlock without
From:       Simon Arlott <simon () fire ! lp0 ! eu>
Date:       2009-04-23 17:32:13
Message-ID: 49F0A61D.1010002 () simon ! arlott ! org ! uk
[Download RAW message or body]

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.

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
---
This has been on my TODO list for far too long... I did come
up with a mutex_trylock/mutex_lock_interruptible version but
claiming that it'll block when it may not doesn't make sense
(and any blocking read would cause all non-blocking reads to
continually return -EWOULDBLOCK until there is data).

 drivers/media/dvb/dvb-core/dmxdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c
index c35fbb8..d6d098a 100644
--- a/drivers/media/dvb/dvb-core/dmxdev.c
+++ b/drivers/media/dvb/dvb-core/dmxdev.c
@@ -247,7 +247,7 @@ static ssize_t dvb_dvr_read(struct file *file, char __user *buf, size_t count,
 	int ret;
 
 	if (dmxdev->exit) {
-		mutex_unlock(&dmxdev->mutex);
+		//mutex_unlock(&dmxdev->mutex);
 		return -ENODEV;
 	}
 
-- 
1.6.2.2

-- 
Simon Arlott

_______________________________________________
linux-dvb users mailing list
For V4L/DVB development, please use instead linux-media@vger.kernel.org
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic