From: Alexander Strakh <strakh@ispras.ru>
To: linux-kernel@vger.kernel.org, kangyong@telegent.com,
xbzhang@telegent.com, zyziii@telegent.com, shijie8@gmail.com,
Mauro Carvalho Chehab <mchehab@infradead.org>,
linux-media@vger.kernel.org
Subject: BUG: double mutex_unlock in drivers/media/video/tlg2300/pd-video.c
Date: Mon, 13 Dec 2010 18:59:14 +0300 [thread overview]
Message-ID: <201012131859.15152.strakh@ispras.ru> (raw)
KERNEL_VERSION: 2.6.36
SUBJECT: double mutex_lock in drivers/media/video/tlg2300/pd-video.c
in function vidioc_s_fmt
SUBSCRIBE:
First mutex_unlock in function pd_vidioc_s_fmt in line 767:
764 ret |= send_set_req(pd, VIDEO_ROSOLU_SEL,
765 vid_resol, &cmd_status);
766 if (ret || cmd_status) {
767 mutex_unlock(&pd->lock);
768 return -EBUSY;
769 }
Second mutex_unlock in function vidioc_s_fmt in line 806:
805 pd_vidioc_s_fmt(pd, &f->fmt.pix);
806 mutex_unlock(&pd->lock);
Found by Linux Device Drivers Verification Project
Сhecks the return code of pd_vidioc_s_fm before mutex_unlocking.
Signed-off-by: Alexander Strakh <strakh@ispras.ru>
---
diff --git a/drivers/media/video/tlg2300/pd-video.c
b/drivers/media/video/tlg2300/pd-video.c
index a1ffe18..fe6bd2b 100644
--- a/drivers/media/video/tlg2300/pd-video.c
+++ b/drivers/media/video/tlg2300/pd-video.c
@@ -802,8 +802,8 @@ static int vidioc_s_fmt(struct file *file, void *fh,
struct v4l2_format *f)
return -EINVAL;
}
- pd_vidioc_s_fmt(pd, &f->fmt.pix);
- mutex_unlock(&pd->lock);
+ if(!pd_vidioc_s_fmt(pd, &f->fmt.pix))
+ mutex_unlock(&pd->lock);
return 0;
}
next reply other threads:[~2010-12-13 15:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-13 15:59 Alexander Strakh [this message]
2010-12-14 1:34 ` BUG: double mutex_unlock in drivers/media/video/tlg2300/pd-video.c Huang Shijie
2010-12-22 16:32 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201012131859.15152.strakh@ispras.ru \
--to=strakh@ispras.ru \
--cc=kangyong@telegent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=shijie8@gmail.com \
--cc=xbzhang@telegent.com \
--cc=zyziii@telegent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox