lkml.org 
[lkml]   [2011]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] staging/easycap: fix mismatch in easycap_poll() mutex lock-unlock
Date
In case if condition (kd != isdongle(peasycap)) becomes true,
easycap_poll() returns without releasing easycapdc60_dongle[kd].mutex_video.
The patch adds mutex_unlock() before that return.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
drivers/staging/easycap/easycap_main.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/easycap/easycap_main.c b/drivers/staging/easycap/easycap_main.c
index bea2816..3ea51c3 100644
--- a/drivers/staging/easycap/easycap_main.c
+++ b/drivers/staging/easycap/easycap_main.c
@@ -953,8 +953,10 @@ static unsigned int easycap_poll(struct file *file, poll_table *wait)
* peasycap, IN WHICH CASE A REPEAT CALL TO isdongle() WILL FAIL.
* IF NECESSARY, BAIL OUT.
*/
- if (kd != isdongle(peasycap))
+ if (kd != isdongle(peasycap)) {
+ mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -ERESTARTSYS;
+ }
if (!file) {
SAY("ERROR: file is NULL\n");
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
--
1.7.4.1


\
 
 \ /
  Last update: 2011-08-29 19:49    [W:0.047 / U:0.684 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site