diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-05-17 20:20:50 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-05-17 20:20:50 +0000 |
commit | 483bc6dfc62422269463169947222cab1762c07d (patch) | |
tree | 57155bd480c258f942412655e7e29f320dfdf481 /linux/drivers/media | |
parent | 05da578ca1e11f37b78f9821a7c26dcd603fb5bb (diff) | |
download | mediapointer-dvb-s2-483bc6dfc62422269463169947222cab1762c07d.tar.gz mediapointer-dvb-s2-483bc6dfc62422269463169947222cab1762c07d.tar.bz2 |
[PATCH] Fix a deadlock in the bttv driver
From: Arjan van de Ven <arjan@linux.intel.com>
vidiocgmbuf() does this:
mutex_lock(&fh->cap.vb_lock);
retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize,
V4L2_MEMORY_MMAP);
and videobuf_mmap_setup() then just does
mutex_lock(&q->vb_lock);
ret = __videobuf_mmap_setup(q, bcount, bsize, memory);
mutex_unlock(&q->vb_lock);
which is an obvious double-take deadlock.
This patch fixes this by having vidiocgmbuf() just call the __videobuf_mmap_setup
function instead.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/video/bt8xx/bttv-driver.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/videobuf-core.c | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c index 303422115..a836e0ed4 100644 --- a/linux/drivers/media/video/bt8xx/bttv-driver.c +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c @@ -2654,7 +2654,7 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) struct bttv_fh *fh = priv; mutex_lock(&fh->cap.vb_lock); - retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, + retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, V4L2_MEMORY_MMAP); if (retval < 0) { mutex_unlock(&fh->cap.vb_lock); diff --git a/linux/drivers/media/video/videobuf-core.c b/linux/drivers/media/video/videobuf-core.c index fd838dddb..16c32c68c 100644 --- a/linux/drivers/media/video/videobuf-core.c +++ b/linux/drivers/media/video/videobuf-core.c @@ -332,7 +332,7 @@ int videobuf_mmap_free(struct videobuf_queue *q) } /* Locking: Caller holds q->vb_lock */ -static int __videobuf_mmap_setup(struct videobuf_queue *q, +int __videobuf_mmap_setup(struct videobuf_queue *q, unsigned int bcount, unsigned int bsize, enum v4l2_memory memory) { @@ -1130,6 +1130,7 @@ EXPORT_SYMBOL_GPL(videobuf_read_stream); EXPORT_SYMBOL_GPL(videobuf_read_one); EXPORT_SYMBOL_GPL(videobuf_poll_stream); +EXPORT_SYMBOL_GPL(__videobuf_mmap_setup); EXPORT_SYMBOL_GPL(videobuf_mmap_setup); EXPORT_SYMBOL_GPL(videobuf_mmap_free); EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); |