From: Hans Verkuil <hans.verk...@cisco.com>

Check if the vb2 queue uses requests, and if so refuse to
add buffers that are not part of a request.

We might relax this in the future, but for now just return
-EBUSY in that case.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
---
 drivers/media/common/videobuf2/videobuf2-v4l2.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c 
b/drivers/media/common/videobuf2/videobuf2-v4l2.c
index 499b2ab3d1fa..05004b26a705 100644
--- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
+++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
@@ -378,8 +378,13 @@ 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 -EBUSY;
+               }
                return 0;
+       }
 
        /*
         * For proper locking when queueing a request you need to be able
-- 
2.17.0

Reply via email to