Skip to content

Commit

Permalink
staging/easycap: fix mismatch in easycap_poll() mutex lock-unlock
Browse files Browse the repository at this point in the history
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>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alexey Khoroshilov authored and Greg Kroah-Hartman committed Aug 29, 2011
1 parent 0f18f76 commit 22f88fc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/staging/easycap/easycap_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 22f88fc

Please sign in to comment.