summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2011-10-12 13:09:53 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-08 08:59:33 -0200
commit2c2dd6ac738d8a22def46e073fb7383cac8fa180 (patch)
treeedacdfe8a4392fca7caae99e2cd72368179bb118 /drivers/media
parente836a1c078e230dd5a94bb086b186c2be3ec6a84 (diff)
downloadlinux-3.10-2c2dd6ac738d8a22def46e073fb7383cac8fa180.tar.gz
linux-3.10-2c2dd6ac738d8a22def46e073fb7383cac8fa180.tar.bz2
linux-3.10-2c2dd6ac738d8a22def46e073fb7383cac8fa180.zip
[media] media: vb2: add a check for uninitialized buffer
__buffer_in_use() might be called for empty/uninitialized buffer in the following scenario: REQBUF(n, USER_PTR), QUERYBUF(). This patch fixes kernel ops in such case. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> CC: Pawel Osciak <pawel@osciak.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/videobuf2-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c
index 979e544388c..9bb92145ad5 100644
--- a/drivers/media/video/videobuf2-core.c
+++ b/drivers/media/video/videobuf2-core.c
@@ -296,14 +296,14 @@ static bool __buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb)
{
unsigned int plane;
for (plane = 0; plane < vb->num_planes; ++plane) {
+ void *mem_priv = vb->planes[plane].mem_priv;
/*
* If num_users() has not been provided, call_memop
* will return 0, apparently nobody cares about this
* case anyway. If num_users() returns more than 1,
* we are not the only user of the plane's memory.
*/
- if (call_memop(q, plane, num_users,
- vb->planes[plane].mem_priv) > 1)
+ if (mem_priv && call_memop(q, plane, num_users, mem_priv) > 1)
return true;
}
return false;