aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-16 10:31:02 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-16 10:31:02 -0700
commit924973508bf15f2cabbbef7b5c428131fbbd812b (patch)
treead7a0893b8b2cf43941a6aa3a0b15e9bca533004 /fs/sysfs
parentMerge tag '5.1-rc-smb3' of git://git.samba.org/sfrench/cifs-2.6 (diff)
parentfix sysfs_init_fs_context() in !CONFIG_NET_NS case (diff)
downloadlinux-dev-924973508bf15f2cabbbef7b5c428131fbbd812b.tar.xz
linux-dev-924973508bf15f2cabbbef7b5c428131fbbd812b.zip
Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs mount infrastructure fix from Al Viro: "Fixup for sysfs braino. Capabilities checks for sysfs mount do include those on netns, but only if CONFIG_NET_NS is enabled. Sorry, should've caught that earlier..." * 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fix sysfs_init_fs_context() in !CONFIG_NET_NS case
Diffstat (limited to 'fs/sysfs')
-rw-r--r--fs/sysfs/mount.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 4cb21b558a85..1b56686ab178 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -71,9 +71,11 @@ static int sysfs_init_fs_context(struct fs_context *fc)
kfc->magic = SYSFS_MAGIC;
fc->fs_private = kfc;
fc->ops = &sysfs_fs_context_ops;
- if (fc->user_ns)
- put_user_ns(fc->user_ns);
- fc->user_ns = get_user_ns(netns->user_ns);
+ if (netns) {
+ if (fc->user_ns)
+ put_user_ns(fc->user_ns);
+ fc->user_ns = get_user_ns(netns->user_ns);
+ }
fc->global = true;
return 0;
}