diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2018-05-23 15:09:23 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-08-31 18:23:39 +0300 |
commit | 9ac8090fda77f072815c209c80fb230e89cda18c (patch) | |
tree | 7295712f0122b5d775bff07ff470179258b8f9da /drivers/media/common/videobuf2/videobuf2-v4l2.c | |
parent | 61add367dda6309ee1702d85344b5fcbd6ede9a1 (diff) | |
download | linux-9ac8090fda77f072815c209c80fb230e89cda18c.tar.xz |
media: videobuf2-v4l2: refuse qbuf if queue uses requests or vv.
Check if the vb2 queue uses requests, and if so refuse to
add buffers that are not part of a request. Also check for
the reverse: a vb2 queue did not use requests, and an attempt
was made to queue a buffer to a request.
We might relax this in the future, but for now just return
-EPERM in that case.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/common/videobuf2/videobuf2-v4l2.c')
-rw-r--r-- | drivers/media/common/videobuf2/videobuf2-v4l2.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c index 364b1fea3826..a70df16d68f1 100644 --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c @@ -378,8 +378,16 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *md return ret; } - if (!(b->flags & V4L2_BUF_FLAG_REQUEST_FD)) + if (!(b->flags & V4L2_BUF_FLAG_REQUEST_FD)) { + if (q->uses_requests) { + dprintk(1, "%s: queue uses requests\n", opname); + return -EPERM; + } return 0; + } else if (q->uses_qbuf) { + dprintk(1, "%s: queue does not use requests\n", opname); + return -EPERM; + } /* * For proper locking when queueing a request you need to be able |