From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B9A5C4743C for ; Mon, 14 Jun 2021 17:04:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 685DA61352 for ; Mon, 14 Jun 2021 17:04:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235416AbhFNRGu (ORCPT ); Mon, 14 Jun 2021 13:06:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235102AbhFNRGt (ORCPT ); Mon, 14 Jun 2021 13:06:49 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A2BCC061767; Mon, 14 Jun 2021 10:04:46 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A543F436; Mon, 14 Jun 2021 19:04:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1623690284; bh=Y6kZhAkHeLzvqk5DlBXOp7E5flMwNJLdlCS66qJQBw4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eBOMjvG/5Yu0Yyl3EVPMy0ekkQ/GZmYW7F7QDFeljkKttg8XUpr/Tce0p5XGaVwiB xY6nNbyND4EGO+W0M6lIEpIGcyYPdZW32PgF9hox+pJBOGxPBaAU0+kinFdR4NhkIN 5VH3NSidSVJkM2Eao/JGyPNNLyv39mX+4BGhv6bk= Date: Mon, 14 Jun 2021 20:04:25 +0300 From: Laurent Pinchart To: Arnd Bergmann Cc: Hans Verkuil , Mauro Carvalho Chehab , Arnd Bergmann , "Lad, Prabhakar" , Eduardo Valentin , Sakari Ailus , Greg Kroah-Hartman , Vaibhav Gupta , Liu Shixin , Jacopo Mondi , Andy Shevchenko , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: Re: [PATCH v3 5/8] media: v4l2-core: return -ENODEV from ioctl when not registered Message-ID: References: <20210614103409.3154127-1-arnd@kernel.org> <20210614103409.3154127-6-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210614103409.3154127-6-arnd@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, Thank you for the patch. On Mon, Jun 14, 2021 at 12:34:06PM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann > > I spotted a minor difference is handling of unregistered devices > between native and compat ioctls: the native handler never tries > to call into the driver if a device is not marked as registered. > > I did not check whether this can cause issues in the kernel, or > just a different between return codes, but it clearly makes > sense that both should behave the same way. > > Signed-off-by: Arnd Bergmann Reviewed-by: Laurent Pinchart > --- > drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > index 0ca75f6784c5..47aff3b19742 100644 > --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c > @@ -1244,6 +1244,9 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) > if (!file->f_op->unlocked_ioctl) > return ret; > > + if (!video_is_registered(vdev)) > + return -ENODEV; > + > if (_IOC_TYPE(cmd) == 'V' && _IOC_NR(cmd) < BASE_VIDIOC_PRIVATE) > ret = file->f_op->unlocked_ioctl(file, cmd, > (unsigned long)compat_ptr(arg)); -- Regards, Laurent Pinchart