Received: by 10.213.65.68 with SMTP id h4csp160119imn; Wed, 21 Mar 2018 15:07:18 -0700 (PDT) X-Google-Smtp-Source: AG47ELsf6WCK/ovpYEqqA64wTF/o/YgpMQQYcEtHtgiEJ4clKaH55ZMdgewZ4yWjTZCmya+Zi83X X-Received: by 2002:a17:902:a70f:: with SMTP id w15-v6mr22357392plq.79.1521670038072; Wed, 21 Mar 2018 15:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521670038; cv=none; d=google.com; s=arc-20160816; b=E0L11s9DeVeetHoJeeyxOkSz/AxCC+ZR5lwUroUYDEPOijz5jKGHOQSasi6xaJqCWw SQgt3WCjT0lAv+eEzjOR8Kb364orA52QuvY34+JMWt8LLWlMbYgSHUF/Nix/HGQmcYLq FugOkm+10cIwPOWW9MPEfIb0qCPzAxlzMwldVkm9bNC7FKLo6oJHtYuYqIQ6zHHlNjhI GBM+t7knWd/tVQwLzKDisJ/YwGe5qs9faX8+yzdVdRqjONY9vhb02uVH4CFYygRiguWY aFSFsNP8HqwCfr5lMLs8YMSyHbdkOq89+8ywvxGg93dNoJGA3jlYQsyoMwNuM5ZQxnTJ vL8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=tzX0k7JYmB/eR9WyfrXaPpFMOVhWHcKHYP0W/WKYA+Y=; b=fX2m+47t7KHFflTkDeFbrWhbUk45O+BQD3sXPeFxWCFanulaSY7UDWgU0byRewPvHi BwvvsI8iD/Qp8ako2AjqSxOv2V9ld3Q5Kh/ucNYPHTjTGGD8ktWFkzXdjkym2a0rInxE vT/0cBSh+y5CxIyI81i1cFzYy+eTmWfrHKFF9ckt7+gW5xQoE4/OKOVmDBwll2p5vgGe QRTnIyJWdMV45ajhZYYgZSQZqBSbU+DUO29TxZrNHofnA2ayJvj+We87eGRgph9G8u+i +7TZFBPiemCQagvlggLw4KjUV8uq9ZiNWMxKCza7ou+OtnZ/epuzd9Lg+IFHdeP0xjhs //YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=T/BVq3Kc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9-v6si4538580pls.108.2018.03.21.15.06.33; Wed, 21 Mar 2018 15:07:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=T/BVq3Kc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753884AbeCUWDF (ORCPT + 99 others); Wed, 21 Mar 2018 18:03:05 -0400 Received: from galahad.ideasonboard.com ([185.26.127.97]:43071 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753744AbeCUWDC (ORCPT ); Wed, 21 Mar 2018 18:03:02 -0400 Received: from avalon.localnet (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id ECB5F20064; Wed, 21 Mar 2018 23:00:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1521669639; bh=QH7eXX8JubcYL1hpv7Aydzdsmjx9PFnJtTeo+pX14ys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T/BVq3KcdqD/mIOS5JjOvdVAFQw4x68oM9xUSUTcRmIFvjYVAEX7oASd3RXeb8iRJ Fu0hgTVie826ArgxuejXRrkrtl3x1Y44e8medkDR3pN7o9v+MkX5BSMLOR1SSiCdqc Jzzn8A3Kj+rQkM1eMB4GOzhFJChG0zUu+A3rrNag= From: Laurent Pinchart To: Kieran Bingham Cc: linux-media@vger.kernel.org, Edgar Thier , Mauro Carvalho Chehab , open list Subject: Re: [PATCH] media: uvcvideo: Prevent setting unavailable flags Date: Thu, 22 Mar 2018 00:04:07 +0200 Message-ID: <3340488.XSnhISeh4i@avalon> Organization: Ideas on Board Oy In-Reply-To: <1521646988-803-1-git-send-email-kieran.bingham@ideasonboard.com> References: <1521646988-803-1-git-send-email-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kieran, Thank you for the patch. On Wednesday, 21 March 2018 17:43:08 EET Kieran Bingham wrote: > The addition of an extra operation to use the GET_INFO command > overwrites all existing flags from the uvc_ctrls table. This includes > setting all controls as supporting GET_MIN, GET_MAX, GET_RES, and > GET_DEF regardless of whether they do or not. > > Move the initialisation of these control capabilities directly to the > uvc_ctrl_fill_xu_info() call where they were originally located in that > use case, and ensure that the new functionality in uvc_ctrl_get_flags() > will only set flags based on their reported capability from the GET_INFO > call. > > Fixes: 859086ae3636 ("media: uvcvideo: Apply flags from device to actual > properties") > > Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart And applied to my tree. Mauro, this fixes a regression in your master branch queued for v4.17. Do you want a pull request now, or after the merge window for -rc2 ? > --- > drivers/media/usb/uvc/uvc_ctrl.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/drivers/media/usb/uvc/uvc_ctrl.c > b/drivers/media/usb/uvc/uvc_ctrl.c index 1daf444371be..4042cbdb721b 100644 > --- a/drivers/media/usb/uvc/uvc_ctrl.c > +++ b/drivers/media/usb/uvc/uvc_ctrl.c > @@ -1607,14 +1607,12 @@ static int uvc_ctrl_get_flags(struct uvc_device > *dev, ret = uvc_query_ctrl(dev, UVC_GET_INFO, ctrl->entity->id, > dev->intfnum, info->selector, data, 1); > if (!ret) > - info->flags = UVC_CTRL_FLAG_GET_MIN | UVC_CTRL_FLAG_GET_MAX > - | UVC_CTRL_FLAG_GET_RES | UVC_CTRL_FLAG_GET_DEF > - | (data[0] & UVC_CONTROL_CAP_GET ? > - UVC_CTRL_FLAG_GET_CUR : 0) > - | (data[0] & UVC_CONTROL_CAP_SET ? > - UVC_CTRL_FLAG_SET_CUR : 0) > - | (data[0] & UVC_CONTROL_CAP_AUTOUPDATE ? > - UVC_CTRL_FLAG_AUTO_UPDATE : 0); > + info->flags |= (data[0] & UVC_CONTROL_CAP_GET ? > + UVC_CTRL_FLAG_GET_CUR : 0) > + | (data[0] & UVC_CONTROL_CAP_SET ? > + UVC_CTRL_FLAG_SET_CUR : 0) > + | (data[0] & UVC_CONTROL_CAP_AUTOUPDATE ? > + UVC_CTRL_FLAG_AUTO_UPDATE : 0); > > kfree(data); > return ret; > @@ -1689,6 +1687,9 @@ static int uvc_ctrl_fill_xu_info(struct uvc_device > *dev, > > info->size = le16_to_cpup((__le16 *)data); > > + info->flags = UVC_CTRL_FLAG_GET_MIN | UVC_CTRL_FLAG_GET_MAX > + | UVC_CTRL_FLAG_GET_RES | UVC_CTRL_FLAG_GET_DEF; > + > ret = uvc_ctrl_get_flags(dev, ctrl, info); > if (ret < 0) { > uvc_trace(UVC_TRACE_CONTROL, -- Regards, Laurent Pinchart