Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp525117pxf; Wed, 17 Mar 2021 09:46:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynKAjyBzwvhhsxqCEagzT7s88H7jlOuyUbUcuY425Obzu+j7eWDPNH/foIo5tw60QrAvYo X-Received: by 2002:a17:906:3385:: with SMTP id v5mr36392048eja.539.1615999613461; Wed, 17 Mar 2021 09:46:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615999613; cv=none; d=google.com; s=arc-20160816; b=04QbJXg6eHOCv8JUgNs7qpEFW6StUDX+MKwiNfXQ5Oc3bVFu7uq2yNyN2j8Xm7gol4 ffOwFebNIW0O4SnRLkG2hAhZ1TRGK22IbVAZeekYCqM6XdnlitT05xMTs9v22g2dp3qe QFyfWxCqs3bPEhF9EQ7v0VZyQLjItRifBT/JXrJQnLkE+ybrh1SuhRW92ptvzHpnkyzK 6gH9PcSj03WsD6okEIazWmD9Rn56XkdqyuiWpFYFger+bOMWncsZf+m/xrZPjEYSVqfc lCwSRA3rIZTjdTB7BeQtv/qJ8FeVdfyWdbUjZ2lt23UBF7G43fZiJrfQO2vpp04zl9u7 jreA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2RKdLF2sp2nWSuacDzuOWi0sXk9JfjBGvDHGz4cIafk=; b=IMhINY+tw/JZ9HlehKIc8+UtetMa4u3++bzz3KQg5k4ek+qKi/wVjB5Auiwpdzw0+a mxDXrnkWjkXNVTBlFvjWzHo9RNZ1NUjvd41z4pQ0TdVODzOJGLvzUF4DBwnBYqqaCs5y M2fmqniiZD/HljDG+Gi1OxCjUi/wFDxW/jhrpORNNQTC0lll3k9VZVcYRKokkcYb6N5w VCaf1DMhzdDtdrLFK0SJJ09AiNjLe8ZfbtVhcZ4rLYj8ZsjKy46d4SqKS/aZm/w9eV/P DVstZ9XE0+QMhuWl16NaXwqgtQS78bqDRw2mFFxKS8m7s2rs1epoa8vph/k4jlNcAk1H kpIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=k+ThYHIu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t16si17593735edc.448.2021.03.17.09.46.29; Wed, 17 Mar 2021 09:46:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=k+ThYHIu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232717AbhCQQpg (ORCPT + 99 others); Wed, 17 Mar 2021 12:45:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232630AbhCQQpS (ORCPT ); Wed, 17 Mar 2021 12:45:18 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F00C2C061760 for ; Wed, 17 Mar 2021 09:45:17 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id dx17so3701975ejb.2 for ; Wed, 17 Mar 2021 09:45:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2RKdLF2sp2nWSuacDzuOWi0sXk9JfjBGvDHGz4cIafk=; b=k+ThYHIuc2NjaaoljJGSTYAoaeumkGrLMqub4uoq2IJOu9R6RS6ItFvAfsa9qHTzaM dmoQUa8W2Vi/BVV1WnZ8tfQGvaDN4N8dfCmVz4sPRHMiafkcczuI3fHJmMu5rNFqo5qD r/lPPo2VOIKgTc/4+CPvXYKkjYrcA/dpIP6+U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2RKdLF2sp2nWSuacDzuOWi0sXk9JfjBGvDHGz4cIafk=; b=EPF5bOr9fKFl5/sgNS2GC9BvrCzVnJ8SMe7UOq1P9xGyYzc3bZnxgjfIArjULiwni1 p4J3VmCXRFGUF+1uTNNLEWeNVQUbHEAt0FxfAF6xBDQzXAPYqNELlNQsSvWp9y7+Ly+0 ig6XGJ8loLybj0NmrpiZe/XqWlLHTAf909TwHdkdVWKh51SDS056brLNmMOWMy5W9tbC X3C8PHKxgQDF2Cq8mdY38f91b1QWmLie5dbkEojr8Mn/g9WddjN/BdiAAFh2IvkGDXy6 fh7xtpVdphsslXiOXMNjPFKvZhOM/+k0vSxgDxXR+L0ZRuWgA35BbqC7U41BZsNy+DOt OE6A== X-Gm-Message-State: AOAM532Uhn6CUZ6d/7DlxgDOvfcD6xDPa25Faweo3A7Pghrr6jcrrzDC vftaGdDYXRzytopvKCKXrCN+Wg== X-Received: by 2002:a17:906:22d2:: with SMTP id q18mr36389148eja.437.1615999516492; Wed, 17 Mar 2021 09:45:16 -0700 (PDT) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id hy25sm12088128ejc.119.2021.03.17.09.45.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 09:45:16 -0700 (PDT) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sergey Senozhatsky , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, tfiga@chromium.org Cc: Ricardo Ribalda , stable@vger.kernel.org Subject: [PATCH v6 04/17] media: v4l2-ioctl: check_ext_ctrls: Fix V4L2_CTRL_WHICH_DEF_VAL Date: Wed, 17 Mar 2021 17:44:58 +0100 Message-Id: <20210317164511.39967-5-ribalda@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210317164511.39967-1-ribalda@chromium.org> References: <20210317164511.39967-1-ribalda@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Drivers that do not use the ctrl-framework use this function instead. Default value cannot be changed, return EINVAL as soon as possible. Cc: stable@vger.kernel.org Fixes: 6fa6f831f095 ("media: v4l2-ctrls: add core request support") Signed-off-by: Ricardo Ribalda --- drivers/media/v4l2-core/v4l2-ioctl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 528eb5f420f6..ccd21b4d9c72 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -929,6 +929,13 @@ static bool check_ext_ctrls(struct v4l2_ext_controls *c, unsigned long ioctl) return false; break; case V4L2_CTRL_WHICH_DEF_VAL: + /* Default value cannot be changed */ + if (ioctl == VIDIOC_S_EXT_CTRLS || + ioctl == VIDIOC_TRY_EXT_CTRLS) { + c->error_idx = c->count; + return false; + } + return true; case V4L2_CTRL_WHICH_CUR_VAL: return true; case V4L2_CTRL_WHICH_REQUEST_VAL: -- 2.31.0.rc2.261.g7f71774620-goog