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=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 DB62EC2D0EF for ; Thu, 16 Apr 2020 06:44:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A0599206D6 for ; Thu, 16 Apr 2020 06:44:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0599206D6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4B1AD8E0094; Thu, 16 Apr 2020 02:44:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 461F88E0001; Thu, 16 Apr 2020 02:44:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32B318E0094; Thu, 16 Apr 2020 02:44:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0124.hostedemail.com [216.40.44.124]) by kanga.kvack.org (Postfix) with ESMTP id 184008E0001 for ; Thu, 16 Apr 2020 02:44:09 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id CA7B71F1A for ; Thu, 16 Apr 2020 06:44:08 +0000 (UTC) X-FDA: 76712778576.13.blood23_414307a550159 X-HE-Tag: blood23_414307a550159 X-Filterd-Recvd-Size: 7200 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Thu, 16 Apr 2020 06:44:08 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id a23so1019587plm.1 for ; Wed, 15 Apr 2020 23:44:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=eihWpoiPluNClprWA5IrbR8QX54DG9JK4Pz3fjQ6jyU=; b=sXx1nCyp5A05M78mwLl7FCa/PG51r0+/z9Nem+owFsR4EHqcBEi26BthbDSJ8+UnyG AbkI8SiiZnV8oyfSrOzDMassXxTiJpr8C5bYKNmZuiaDDRGszday0b6Rvpk2ySoVm0pg QjnofcnpbxEiG6nbjz87V39dqXfDkvSKugenhNL1JZjxL7VeAaEiGNrxfCG3lln0PgIn fQryEv9YMJwXgPhKTJAh90VHodg7Uehe8w/PxqPtDpSDCsl/luhAVkwCHnVXZJ+yU3g0 yUARoxVP6qChFl4Ln7ZZatQHnnMkWLbWc/G7XwvtA0zy4zLx2q+HNCVZcz2kuAvqoo2Y /xgQ== X-Gm-Message-State: AGi0PuapH5XXbkM+uZVWmXOTCejCBllnizzAGLh7vy5ebGvsx0pZtCgU a8SPGzjLBxFbhkvYrR1zvhA= X-Google-Smtp-Source: APiQypICKIRvvkGmz8ppjoCQvnQz4lqP0uU4YHS4vVlOPBKXHmJ3+sfVrDFwAF5gqJSb9SA+HXqWoA== X-Received: by 2002:a17:90a:284e:: with SMTP id p14mr3379414pjf.10.1587019447487; Wed, 15 Apr 2020 23:44:07 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id s74sm821277pgc.50.2020.04.15.23.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2020 23:44:06 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 4F61640277; Thu, 16 Apr 2020 06:44:05 +0000 (UTC) Date: Thu, 16 Apr 2020 06:44:05 +0000 From: Luis Chamberlain To: Emanuele Giuseppe Esposito , Goldwyn Rodrigues Cc: linux-nfs@vger.kernel.org, Paolo Bonzini , Jeremy Kerr , Arnd Bergmann , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Dennis Dalessandro , Mike Marciniszyn , Doug Ledford , Jason Gunthorpe , Frederic Barrat , Andrew Donnellan , Greg Kroah-Hartman , Robert Richter , "Manoj N. Kumar" , "Matthew R. Ochs" , Uma Krishnan , "James E.J. Bottomley" , "Martin K. Petersen" , Felipe Balbi , Alexander Viro , Ian Kent , Joel Becker , Christoph Hellwig , "Rafael J. Wysocki" , Matthew Garrett , Ard Biesheuvel , Miklos Szeredi , Mike Kravetz , Mark Fasheh , Joseph Qi , Alexey Dobriyan , Kees Cook , Iurii Zaikin , Anton Vorontsov , Colin Cross , Tony Luck , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , Hugh Dickins , Andrew Morton , "J. Bruce Fields" , Chuck Lever , Trond Myklebust , Anna Schumaker , "David S. Miller" , Jakub Kicinski , James Morris , "Serge E. Hallyn" , John Johansen , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, oprofile-list@lists.sf.net, linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org, linux-fsdevel@vger.kernel.org, autofs@vger.kernel.org, linux-efi@vger.kernel.org, linux-mm@kvack.org, ocfs2-devel@oss.oracle.com, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null Message-ID: <20200416064405.GP11244@42.do-not-panic.com> References: <20200414124304.4470-1-eesposit@redhat.com> <20200414124304.4470-2-eesposit@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200414124304.4470-2-eesposit@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote: > aa_mk_null_file is using simple_pin_fs/simple_release_fs with local > variables as arguments, for what would amount to a simple > vfs_kern_mount/mntput pair if everything was inlined. Just use > the normal filesystem API since the reference counting is not needed > here. *Why* is refcounting not needed here? Luis > > Signed-off-by: Emanuele Giuseppe Esposito > --- > security/apparmor/apparmorfs.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c > index 280741fc0f5f..828bb1eb77ea 100644 > --- a/security/apparmor/apparmorfs.c > +++ b/security/apparmor/apparmorfs.c > @@ -2525,14 +2525,14 @@ struct path aa_null; > > static int aa_mk_null_file(struct dentry *parent) > { > - struct vfsmount *mount = NULL; > + struct file_system_type *type = parent->d_sb->s_type; > + struct vfsmount *mount; > struct dentry *dentry; > struct inode *inode; > - int count = 0; > - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count); > > - if (error) > - return error; > + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL); > + if (IS_ERR(mount)) > + return PTR_ERR(mount); > > inode_lock(d_inode(parent)); > dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME)); > @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent) > dput(dentry); > out: > inode_unlock(d_inode(parent)); > - simple_release_fs(&mount, &count); > + mntput(mount); > return error; > } > > -- > 2.25.2 >