From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org, Christoph Hellwig <hch@lst.de>,
Andrew Donnellan <ajd@linux.ibm.com>,
Emanuele Giuseppe Esposito <eesposit@redhat.com>,
linux-scsi@vger.kernel.org, James Morris <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
Daniel Vetter <daniel@ffwll.ch>, Arnd Bergmann <arnd@arndb.de>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
"Manoj N. Kumar" <manoj@linux.ibm.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
"Matthew R. Ochs" <mrochs@linux.ibm.com>,
Uma Krishnan <ukrishn@linux.ibm.com>,
John Johansen <john.johansen@canonical.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org,
Thomas Zimmermann <tzimmermann@suse.de>,
Frederic Barrat <fbarrat@linux.ibm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
linuxppc-dev@lists.ozlabs.org, Joel Becker <jlbec@evilplan.org>
Subject: [PATCH v2 1/7] apparmor: just use vfs_kern_mount to make .null
Date: Tue, 21 Apr 2020 15:51:13 +0200 [thread overview]
Message-ID: <20200421135119.30007-2-eesposit@redhat.com> (raw)
In-Reply-To: <20200421135119.30007-1-eesposit@redhat.com>
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 (it is a local variable and always 0 on entry and on exit).
There is no functional change intended.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
security/apparmor/apparmorfs.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 280741fc0f5f..36f848734902 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -2525,14 +2525,15 @@ 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);
+ int error;
- 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 +2562,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
next prev parent reply other threads:[~2020-04-21 14:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-21 13:51 [PATCH v2 0/7] libfs: group and simplify linux fs code Emanuele Giuseppe Esposito
2020-04-21 13:51 ` Emanuele Giuseppe Esposito [this message]
2020-04-21 13:51 ` [PATCH v2 2/7] libfs: wrap simple_pin_fs/simple_release_fs arguments in a struct Emanuele Giuseppe Esposito
2020-04-22 16:50 ` James Morris
2020-04-21 13:57 ` [PATCH v2 3/7] libfs: introduce new_inode_current_time Emanuele Giuseppe Esposito
2020-04-21 13:57 ` [PATCH v2 4/7] libfs: add alloc_anon_inode wrapper Emanuele Giuseppe Esposito
2020-04-21 13:57 ` [PATCH v2 5/7] libfs: add file creation functions Emanuele Giuseppe Esposito
2020-04-21 13:57 ` [PATCH v2 6/7] debugfs: switch to simplefs inode creation API Emanuele Giuseppe Esposito
2020-04-27 15:15 ` Paolo Bonzini
2020-04-21 13:57 ` [PATCH v2 7/7] tracefs: " Emanuele Giuseppe Esposito
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200421135119.30007-2-eesposit@redhat.com \
--to=eesposit@redhat.com \
--cc=airlied@linux.ie \
--cc=ajd@linux.ibm.com \
--cc=arnd@arndb.de \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=fbarrat@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=jejb@linux.ibm.com \
--cc=jlbec@evilplan.org \
--cc=jmorris@namei.org \
--cc=john.johansen@canonical.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=manoj@linux.ibm.com \
--cc=martin.petersen@oracle.com \
--cc=mripard@kernel.org \
--cc=mrochs@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=rafael@kernel.org \
--cc=serge@hallyn.com \
--cc=tzimmermann@suse.de \
--cc=ukrishn@linux.ibm.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).