From patchwork Mon Feb 11 10:13:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 10805469 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E829917E0 for ; Mon, 11 Feb 2019 10:14:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9203283B2 for ; Mon, 11 Feb 2019 10:14:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD5EF28488; Mon, 11 Feb 2019 10:14:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E2C9283B2 for ; Mon, 11 Feb 2019 10:14:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726814AbfBKKOG (ORCPT ); Mon, 11 Feb 2019 05:14:06 -0500 Received: from lb2-smtp-cloud9.xs4all.net ([194.109.24.26]:39042 "EHLO lb2-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbfBKKOD (ORCPT ); Mon, 11 Feb 2019 05:14:03 -0500 Received: from tschai.fritz.box ([212.251.195.8]) by smtp-cloud9.xs4all.net with ESMTPA id t8b7gs8zWRO5Zt8bCg3GoC; Mon, 11 Feb 2019 11:14:02 +0100 From: Hans Verkuil To: linux-media@vger.kernel.org Cc: Dafna Hirschfeld , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil Subject: [PATCHv2 5/6] v4l2-ctrls: check for REQUIRES_REQUESTS flag Date: Mon, 11 Feb 2019 11:13:56 +0100 Message-Id: <20190211101357.48754-6-hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211101357.48754-1-hverkuil-cisco@xs4all.nl> References: <20190211101357.48754-1-hverkuil-cisco@xs4all.nl> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfILXQ21QWdN518UubjzY7T0Hc9Ytel25nuxzv+aOnmKb0BccoT+pkCqto4R/Nb66sd0h08xYr6JhALpUkXpLKTxkq22Qg19gtdp2bictf4CL8WsJeQrr SuYQ73GdjoI2CrZYz2Od5Qqz+flbJWIZDuzFuYyZHYe1AUqIBpIe9p0kM+bGTDBx5e1zUF+wXqG6y1Nq9oYRs++s+HsrxNbgnDPtmbxnhBD95ep4rWa2bDWb T77R0tvedbHOYI6jr0KR/RgLQlown2l6KjTQO0qUNrqU3SA+0l0KcM808+xqQDnX8dG4s+vY+yZbMDmoNFCM5r2wyZwg2OLmHzgKd09gMu0= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Attempts to get/try/set controls that require requests without actually specifying a request are now rejected. Signed-off-by: Hans Verkuil --- drivers/media/v4l2-core/v4l2-ctrls.c | 3 +++ 1 file changed, 3 insertions(+) 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;