lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YEqrGQXEARuyUBUI@pendragon.ideasonboard.com>
Date:   Fri, 12 Mar 2021 01:43:21 +0200
From:   Laurent Pinchart <laurent.pinchart@...asonboard.com>
To:     Ricardo Ribalda <ribalda@...omium.org>
Cc:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        Tomasz Figa <tfiga@...omium.org>, linux-media@...r.kernel.org,
        linux-kernel@...r.kernel.org, senozhatsky@...omium.org,
        Hans Verkuil <hverkuil@...all.nl>, stable@...r.kernel.org,
        Hans Verkuil <hverkuil-cisco@...all.nl>
Subject: Re: [PATCH v2 1/6] media: v4l2-ioctl: Fix check_ext_ctrls

Hi Ricardo,

Thank you for the patch.

On Thu, Mar 11, 2021 at 11:19:41PM +0100, Ricardo Ribalda wrote:
> Drivers that do not use the ctrl-framework use this function instead.
> 
> - Return error when handling of REQUEST_VAL.
> - Do not check for multiple classes when getting the DEF_VAL.
> 
> Fixes v4l2-compliance:
> Control ioctls (Input 0):
> 		fail: v4l2-test-controls.cpp(813): doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)
> 	test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
> 
> Cc: stable@...r.kernel.org
> Fixes: 6fa6f831f095 ("media: v4l2-ctrls: add core request support")
> Suggested-by: Hans Verkuil <hverkuil-cisco@...all.nl>
> Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
> ---
>  drivers/media/v4l2-core/v4l2-ioctl.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 31d1342e61e8..6f6b310e2802 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -924,8 +924,10 @@ static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv)
>  	 */
>  	if (!allow_priv && c->which == V4L2_CID_PRIVATE_BASE)
>  		return 0;
> -	if (!c->which)
> +	if (!c->which || c->which == V4L2_CTRL_WHICH_DEF_VAL)

How about

	if (c->which == V4L2_CTRL_WHICH_CUR_VAL ||
	    c->which == V4L2_CTRL_WHICH_DEF_VAL)

>  		return 1;
> +	if (c->which == V4L2_CTRL_WHICH_REQUEST_VAL)
> +		return 0;

Or possibly

	switch (c->which) {
	case V4L2_CTRL_WHICH_CUR_VAL:
	case V4L2_CTRL_WHICH_DEF_VAL:
		return 1;
	case V4L2_CTRL_WHICH_REQUEST_VAL:
		return 0;
	}

Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>

>  	/* Check that all controls are from the same control class. */
>  	for (i = 0; i < c->count; i++) {
>  		if (V4L2_CTRL_ID2WHICH(c->controls[i].id) != c->which) {

-- 
Regards,

Laurent Pinchart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ