Skip to content

Commit 9249735

Browse files
committed
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
2 parents 9c7dc82 + ab81dab commit 9249735

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fs/sysfs/mount.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ static int sysfs_init_fs_context(struct fs_context *fc)
7171
kfc->magic = SYSFS_MAGIC;
7272
fc->fs_private = kfc;
7373
fc->ops = &sysfs_fs_context_ops;
74-
if (fc->user_ns)
75-
put_user_ns(fc->user_ns);
76-
fc->user_ns = get_user_ns(netns->user_ns);
74+
if (netns) {
75+
if (fc->user_ns)
76+
put_user_ns(fc->user_ns);
77+
fc->user_ns = get_user_ns(netns->user_ns);
78+
}
7779
fc->global = true;
7880
return 0;
7981
}

0 commit comments

Comments
 (0)