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

login
register
mail settings
Submitter Hans Verkuil
Date Feb. 11, 2019, 10:13 a.m.
Message ID <20190211101357.48754-6-hverkuil-cisco@xs4all.nl>
Download mbox | patch
Permalink /patch/54441/
State Superseded
Delegated to: Hans Verkuil
Headers show

Comments

Hans Verkuil - Feb. 11, 2019, 10:13 a.m.
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(+)

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;

Privacy Policy