Message ID | e72bf5c1-833e-ad7a-f92f-05527eabea14@cisco.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers |
Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from <linux-media-owner@vger.kernel.org>) id 1egXgJ-0002OO-LC; Tue, 30 Jan 2018 15:18:44 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752946AbeA3PSi (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Tue, 30 Jan 2018 10:18:38 -0500 Received: from aer-iport-2.cisco.com ([173.38.203.52]:20983 "EHLO aer-iport-2.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751934AbeA3PSg (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 30 Jan 2018 10:18:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1086; q=dns/txt; s=iport; t=1517325516; x=1518535116; h=to:from:subject:message-id:date:mime-version: content-transfer-encoding; bh=TMWLUPqH7CrZC7JteMuEs1XACq3OM9XZSFdjtGK5UuU=; b=Ny79GIl8ZoedbrGyshsAbEIXfw2UPWl/d82x/gyDl7Ob3B/k7MfIxN0i TiQ/pPWZCjNWoTo7+VZF89xfA01YwwT6kNxTbDgkwri8Sv+TqjBDILYPx SlMc9gacuMooFgBY3QBqnqXcuVaw6wly/Y0SiptLAjIU8GULxBeo8pOl2 I=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0BwAQCdi3Ba/xbLJq1bGQEBAQEBAQEBA?= =?us-ascii?q?QEBAQcBAQEBAYUdKINgixipWAqIWRQBAQEBAQEBAQJrKIVNBIEHAiYCXw0GAgE?= =?us-ascii?q?BijGlfYFtOoplAQEIAiaBD4NIg2yBaCmEToFmBIE4g06CZQWkF5VojC2HegJIl?= =?us-ascii?q?nICBAsCGQGBPDYigVAzGggbFYJngmGCF0A3jCKCSwEBAQ?= X-IronPort-AV: E=Sophos;i="5.46,435,1511827200"; d="scan'208";a="1749144" Received: from aer-iport-nat.cisco.com (HELO aer-core-3.cisco.com) ([173.38.203.22]) by aer-iport-2.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jan 2018 15:18:33 +0000 Received: from [10.47.79.81] ([10.47.79.81]) (authenticated bits=0) by aer-core-3.cisco.com (8.14.5/8.14.5) with ESMTP id w0UFIWCl012106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for <linux-media@vger.kernel.org>; Tue, 30 Jan 2018 15:18:33 GMT To: Linux Media Mailing List <linux-media@vger.kernel.org> From: Hans Verkuil <hansverk@cisco.com> Subject: [PATCH] v4l2-compat-ioctl32.c: make ctrl_is_pointer work for subdevs Message-ID: <e72bf5c1-833e-ad7a-f92f-05527eabea14@cisco.com> Date: Tue, 30 Jan 2018 16:18:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-User: hansverk Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org |
Commit Message
Hans Verkuil (hansverk)
Jan. 30, 2018, 3:18 p.m. UTC
If the device is of type VFL_TYPE_SUBDEV then vdev->ioctl_ops
is NULL so the 'if (!ops->vidioc_query_ext_ctrl)' check would fail.
Add a test for !ops to the condition.
All sub-devices that have controls will use the control framework,
so they do not have an equivalent to ops->vidioc_query_ext_ctrl.
Returning false if ops is NULL is the correct thing to do here.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Jan 30, 2018 at 04:18:32PM +0100, Hans Verkuil wrote: > If the device is of type VFL_TYPE_SUBDEV then vdev->ioctl_ops > is NULL so the 'if (!ops->vidioc_query_ext_ctrl)' check would fail. > Add a test for !ops to the condition. > > All sub-devices that have controls will use the control framework, > so they do not have an equivalent to ops->vidioc_query_ext_ctrl. > Returning false if ops is NULL is the correct thing to do here. > > Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> > --- > drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > index bdb5c226d01c..5198c9eeb348 100644 > --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > @@ -770,7 +770,7 @@ static inline bool ctrl_is_pointer(struct file *file, u32 id) > return ctrl && ctrl->is_ptr; > } > > - if (!ops->vidioc_query_ext_ctrl) > + if (!ops || !ops->vidioc_query_ext_ctrl) > return false; > > return !ops->vidioc_query_ext_ctrl(file, fh, &qec) && > -- > 2.14.1 >
Hi Hans, Thank you for the patch. On Tuesday, 30 January 2018 17:18:32 EET Hans Verkuil wrote: > If the device is of type VFL_TYPE_SUBDEV then vdev->ioctl_ops > is NULL so the 'if (!ops->vidioc_query_ext_ctrl)' check would fail. More than that, it would crash. > Add a test for !ops to the condition. > > All sub-devices that have controls will use the control framework, > so they do not have an equivalent to ops->vidioc_query_ext_ctrl. > Returning false if ops is NULL is the correct thing to do here. > > Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> This is missing a Fixes: tag, and a Reported-by: tag would be nice too. Apart from that, Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index > bdb5c226d01c..5198c9eeb348 100644 > --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > @@ -770,7 +770,7 @@ static inline bool ctrl_is_pointer(struct file *file, > u32 id) return ctrl && ctrl->is_ptr; > } > > - if (!ops->vidioc_query_ext_ctrl) > + if (!ops || !ops->vidioc_query_ext_ctrl) > return false; > > return !ops->vidioc_query_ext_ctrl(file, fh, &qec) &&
diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index bdb5c226d01c..5198c9eeb348 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -770,7 +770,7 @@ static inline bool ctrl_is_pointer(struct file *file, u32 id) return ctrl && ctrl->is_ptr; } - if (!ops->vidioc_query_ext_ctrl) + if (!ops || !ops->vidioc_query_ext_ctrl) return false; return !ops->vidioc_query_ext_ctrl(file, fh, &qec) &&