Received: by 10.223.185.116 with SMTP id b49csp2292842wrg; Thu, 15 Feb 2018 09:22:20 -0800 (PST) X-Google-Smtp-Source: AH8x2271y/8ZW57+jqVlTkzsN71YdIU2cyWMoD9hSnbtCkmf3tgbbSQqdtx/DIHCR6nGB5trST7c X-Received: by 2002:a17:902:7717:: with SMTP id n23-v6mr2325587pll.388.1518715339968; Thu, 15 Feb 2018 09:22:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518715339; cv=none; d=google.com; s=arc-20160816; b=erf3VmcE1JalWWRnK2nW6uRM3yutuGRYygXZcwYCjmib7iAqEYDiceZLTBmDGF9ATv 3fuc4T9Vxc+Hhv8cwxEKp3d/MGbP0sJNqmUnNLrdylfcyYqn2fj/CIE+vvcsAtZxdMzP bUTL5aSejCTIQApReUmwdkiaKMoirEtdm0KCyjJKEJ2i6djlIsH2MIadmINXBLel22HO nuK4/eGY0T7nri1L8q5RJUEmopmZwKAol0ylcfy9yNwtQgrmIkJlA05uYQif+2ZoXMn0 QR4gqkvlTKSUPaoHC/wEGWvl5aCIdaQt7Bl8FzOJXQhnKDh945meXriolz5bGE8JWF96 Vfhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=yiM4eXOvSTkDAA9YC7x4dO3wNeI0MYDu1qCWpLtBfUI=; b=fJvGVc5lQS5NWgwpZZpptzMkNK/19qj2QEwppJC+jtaaMXkFOHcA4gamN6+ZRyd1kP 5vSsZdTFoUhFsfxOFZ1fgGXz5wBnskf0sA64VpmPj2iWbuvthaQeLi3w6G7hbBu8e0Qn el8iA2lVDQ34E3fncjDH6gGqr/dVBo1CNmUnFCpffnqt+WddLXNZ4PvSywQuF0FgQHyA uk8fAXVu7BwI1pgn3tmSSd+r9/r0/LwA1vMmyh/SxnCZwF8WGkwkbG7dkOi7IJRjZxXl K173FvXwlUwHFJ/vBfand1/WwhlPTgFoKNSTM2zxjdfNJ+WuCSc/BgdXMHJhbGODrKF+ Pv0w== ARC-Authentication-Results: i=1; mx.google.com; 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 u7si8631607pfh.186.2018.02.15.09.22.05; Thu, 15 Feb 2018 09:22:19 -0800 (PST) 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; 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 S1427130AbeBORUV (ORCPT + 99 others); Thu, 15 Feb 2018 12:20:21 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:57460 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422708AbeBOPfb (ORCPT ); Thu, 15 Feb 2018 10:35:31 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 72E19114A; Thu, 15 Feb 2018 15:35:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Hans Verkuil , Sakari Ailus , Laurent Pinchart , Mauro Carvalho Chehab Subject: [PATCH 4.14 132/195] media: v4l2-compat-ioctl32.c: make ctrl_is_pointer work for subdevs Date: Thu, 15 Feb 2018 16:17:03 +0100 Message-Id: <20180215151712.365601797@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151705.738773577@linuxfoundation.org> References: <20180215151705.738773577@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hans Verkuil commit 273caa260035c03d89ad63d72d8cd3d9e5c5e3f1 upstream. 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 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. Fixes: b8c601e8af ("v4l2-compat-ioctl32.c: fix ctrl_is_pointer") Signed-off-by: Hans Verkuil Acked-by: Sakari Ailus Reported-by: Laurent Pinchart Reviewed-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 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(struc 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) &&