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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3A0AC433EF for ; Mon, 2 May 2022 13:06:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235090AbiEBNJr (ORCPT ); Mon, 2 May 2022 09:09:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234924AbiEBNJq (ORCPT ); Mon, 2 May 2022 09:09:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B82464C3; Mon, 2 May 2022 06:06:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AEE146133F; Mon, 2 May 2022 13:06:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4AE0C385AC; Mon, 2 May 2022 13:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651496777; bh=8XYddznJIl/gU5lhFJK7ZW4/j2NWR84fJI8NOxuSgQM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pDz3lWKgEmS8hfZ8IOiXpVMYVkv1CoubXaMUrJbQEctU0cbyssOczu5Tcc1Wd+bwT ru7BMGqbPnGzRe9k4Efe8VZhKyARKshfnrWy0WaaXNHy5wAlsaZeNkEu9VOjRb0KtG uzV/cbJmaQ46eMGA1qr+OiJH2FDtf6yz7SzF/Zj8= Date: Mon, 2 May 2022 15:06:15 +0200 From: Greg KH To: Tetsuo Handa Cc: Sean Young , Alan Stern , Mauro Carvalho Chehab , Jarod Wilson , syzbot , andreyknvl@google.com, linux-media@vger.kernel.org, linux-usb@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [PATCH v2 (resend)] media: imon: reorganize serialization Message-ID: References: <62dddbb9-3053-f284-f9db-3beda5e8e951@I-love.SAKURA.ne.jp> <349f3e34-41ed-f832-3b22-ae10c50e3868@I-love.SAKURA.ne.jp> <21ffa07a-1bc1-cb1f-eef4-6c3a73953061@I-love.SAKURA.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Mon, May 02, 2022 at 10:04:22PM +0900, Tetsuo Handa wrote: > On 2022/05/02 21:53, Greg KH wrote: > >> @@ -153,6 +153,24 @@ struct imon_context { > >> const struct imon_usb_dev_descr *dev_descr; > >> /* device description with key */ > >> /* table for front panels */ > >> + /* > >> + * Fields for deferring free_imon_context(). > >> + * > >> + * Since reference to "struct imon_context" is stored into > >> + * "struct file_operations"->private_data, we need to remember > >> + * how many file descriptors might access this "struct imon_context". > >> + */ > >> + refcount_t users; > > > > Are you sure this is going to work properly? > > > > How do you handle userspace passing around file descriptors to other > > processes? > > > > You really should not ever have to count this. > > Passing around file descriptors results in nothing but delay of freeing memory. > Is this so fatal problem? Not at all, it's just that any driver that tries to count open calls usually is wrong as they forget about this type of thing, which is why I asked. thanks, greg k-h