Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3063221yba; Sat, 11 May 2019 02:57:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqybm0tcMpFYAZd+1fkAp52gzSlwvAS5sCt6rJK2QQ6b3YvolcswgOg91uKkM6mOi4B6EP47 X-Received: by 2002:a17:902:a405:: with SMTP id p5mr13677610plq.51.1557568626658; Sat, 11 May 2019 02:57:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557568626; cv=none; d=google.com; s=arc-20160816; b=SgOeXcEMfhNKJ8MMo+WhSVhqqtDVaZdIQb86TSJMqV1OVoj2EGdcNwRjXsuPZbWizf N52kHd6dXQ9zpOrPtUXnTiKSKJTzh1Z1ytRR9sJakUkA8oDwUr4IqyaU7KPbcMShCZf8 U34VheOWjnz7sDDZz1LBNbieCqSnGtrLyRfS3dpxdCB3V7pgzjkYahUOJ/LW68f2VGTy AwSQ2yLeHKGuuNbyjk01cWYcZIbNtyOTTYbpx/hcoPMqFWeLY49WIrppxyW8pqQyhDrI Odv1cftLmwrFO+SBKY97VjW8VyX3HLWf3qVlKtg9x33/+DqgPRzr8celvjKNfp8KUswN Fu0w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=FZcJEXqVDANWwYB6owLxOgwCD4ERWg2mDzKvoksXMjE=; b=xPrWgrRP32oZ5Eb+powC6qiPyYECwr31zPnRLKbiZOpETFBTPqce204VCiHIlSrXhJ GAQ1q6nnFk/THwUZLW7IIcMqc93i24OXMUsTIq2pmvcWvMbK/CxtORDYnE8kwvyZVVvh pUdAo5wmWeqaEAEkVylRYhEixjAs8ly9+P0vTAbhOS7pKVozlG6Q4+RxSu6qe3YZA3q7 KnvszO4m6qwCGSiaER41PkkkemS3ycTaO8PR+uIFuDs7f0aCSwUD6+BAqL8fIWSv6sXw AWFukRMo9HFZ91bmVFnVxS2sU6iIvscwx6NGKckq3Ba9kE+aHrk1X2dwDI29XDv75xzH e9kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XyhNnMpe; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s205si10182089pgs.467.2019.05.11.02.56.50; Sat, 11 May 2019 02:57:06 -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 header.i=@gmail.com header.s=20161025 header.b=XyhNnMpe; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728507AbfEKJzy (ORCPT + 99 others); Sat, 11 May 2019 05:55:54 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:43841 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725987AbfEKJzy (ORCPT ); Sat, 11 May 2019 05:55:54 -0400 Received: by mail-lj1-f194.google.com with SMTP id z5so7058069lji.10; Sat, 11 May 2019 02:55:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FZcJEXqVDANWwYB6owLxOgwCD4ERWg2mDzKvoksXMjE=; b=XyhNnMpeEdjw84bpxZd5jE8qGuRa5un6YUK9d4dHsa4/h87QvSELcWtIuANWyaJKFJ HoSVoA7xP43Jq4TTE28/cNsoH2z+qafv7gq6NXzEVJHTms32lYuqdig0Jr9NSIg/xL9A Pyty+JHvZQjwWV28ncms35dBqxNsxn1Y+fKvdKtZ3KnYiOjv04xEk0Ax+xhaghnun+er DwVYko6t5FMSE4zYQUI8mS2BlgtP6B4No05fvt3c/beIuGbpoimJR9mvl1M6teCVkiOf 05qZTvySf7spSv93gQP17c+OIgfMCuBcd8iDtomTaCbJBfaxkhCJjE/9/3zpM0rrWo5G rSdA== 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:mime-version :content-transfer-encoding; bh=FZcJEXqVDANWwYB6owLxOgwCD4ERWg2mDzKvoksXMjE=; b=NFfNI740rMSpMsZTZl3P9VnX2aWfsCuc6l/QcKDzUMUrDVp9Z63CceibltUn5WS/ab dRNu3Bc3M7vwAgaJbFzRWQ6zD88Pb3C+sKysciBRgo2BBKvn7/YVMTa+gqEYLs5a0wqZ PBqo8tUm38cO8voA6FTw3avcd7mE7JPk/JzXOXtd+EG+aJYVNT69k61RvWuYxLKjy3Dk TOA6gy232NtGmXueyoBHfuhogc3dJ56Uy4UTPa8s6nHt901D2Ico00J2lS1Y/H+AIv41 73DLoFvykC4BG25gRAAGs9nsEPZU2AuVlZswO5TXzkrlZF3jIPU3/V74J1oZCh0ka/sx 6CdQ== X-Gm-Message-State: APjAAAVvZR9djG23rEAWHkruNKB16tmdlokVMdr4f1NHAH52WNt0WZjW 2q2DvCfkr0BVBKMeKTJUtuw= X-Received: by 2002:a2e:548:: with SMTP id 69mr1207600ljf.176.1557568551907; Sat, 11 May 2019 02:55:51 -0700 (PDT) Received: from z50.gdansk-morena.vectranet.pl (109241207190.gdansk.vectranet.pl. [109.241.207.190]) by smtp.gmail.com with ESMTPSA id x6sm2126224lfn.74.2019.05.11.02.55.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 May 2019 02:55:50 -0700 (PDT) From: Janusz Krzysztofik To: Mauro Carvalho Chehab Cc: Hans Verkuil , Sakari Ailus , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik Subject: [PATCH v3 0/2] media: v4l2-subdev: Verify arguments of v4l2_subdev_call() Date: Sat, 11 May 2019 11:53:57 +0200 Message-Id: <20190511095359.21502-1-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Correctness of format type (try or active) and pad number parameters passed to subdevice operation callbacks is now verified only for IOCTL calls. However, those callbacks are also used by drivers, e.g., V4L2 host interfaces. Since both subdev_do_ioctl() and drivers are using v4l2_subdev_call() macro while calling subdevice operations, move those parameter checks from subdev_do_ioctl() to v4l2_subdev_call(). Also, add a check for a non-NULL pad config pointer if V4L2_SUBDEV_FORMAT_tRY is requested. This way we can avoid taking care of those checks inside drivers. Janusz Krzysztofik (2): media: v4l2-subdev: Verify arguments of v4l2_subdev_call() media: v4l2-subdev: Verify pad config argument drivers/media/v4l2-core/v4l2-subdev.c | 234 ++++++++++++++++---------- include/media/v4l2-subdev.h | 6 + 2 files changed, 151 insertions(+), 89 deletions(-) Changelog: v2->v3: - add patch 2/2 with pad config check, - adjust continuation line alignments in patch 1/2 to match those used in 2/2. v1->v2: - replace the horrible macro with a structure of wrapper functions; inspired by Hans' and Sakari's comments - thanks! -- 2.21.0