diff mbox series

[PATCHv2,5/6] v4l2-ctrls: check for REQUIRES_REQUESTS flag

Message ID 20190211101357.48754-6-hverkuil-cisco@xs4all.nl (mailing list archive)
State New, archived
Headers show
Series vb2/v4l2-ctrls: check if requests are required | expand

Commit Message

Hans Verkuil Feb. 11, 2019, 10:13 a.m. UTC
Attempts to get/try/set controls that require requests
without actually specifying a request are now rejected.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 drivers/media/v4l2-core/v4l2-ctrls.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 99308dac2daa..25f80f0eba69 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -3150,6 +3150,9 @@  static int prepare_ext_ctrls(struct v4l2_ctrl_handler *hdl,
 		ctrl = ref->ctrl;
 		if (ctrl->flags & V4L2_CTRL_FLAG_DISABLED)
 			return -EINVAL;
+		if ((ctrl->flags & V4L2_CTRL_FLAG_REQUIRES_REQUESTS) &&
+		    !hdl->req_obj.req)
+			return -EACCES;
 
 		if (ctrl->cluster[0]->ncontrols > 1)
 			have_clusters = true;