summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-16 20:31:02 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-16 20:31:02 +0300
commit924973508bf15f2cabbbef7b5c428131fbbd812b (patch)
treead7a0893b8b2cf43941a6aa3a0b15e9bca533004
parent9c7dc824d9a48f98b4ee20041e865d97bc73a626 (diff)
parentab81dabda1d4edc1728173be6c6a279455f220e3 (diff)
downloadlinux-924973508bf15f2cabbbef7b5c428131fbbd812b.tar.xz
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
-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;
}