diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2019-03-16 14:45:42 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2019-03-16 14:45:42 +0100 |
commit | ab81dabda1d4edc1728173be6c6a279455f220e3 (patch) | |
tree | 05d94edf3d7c011e1d9661af01b53f57c30a4ff4 /fs/sysfs | |
parent | afs: Use fs_context to pass parameters over automount (diff) | |
download | linux-ab81dabda1d4edc1728173be6c6a279455f220e3.tar.xz linux-ab81dabda1d4edc1728173be6c6a279455f220e3.zip |
fix sysfs_init_fs_context() in !CONFIG_NET_NS case
Permission checks on current's netns should be done only when
netns are enabled.
Reported-by: Dominik Brodowski <linux@dominikbrodowski.net>
Fixes: 23bf1b6be9c2
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/mount.c | 8 |
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; } |