mirror of
https://github.com/torvalds/linux.git
synced 2024-12-30 14:52:05 +00:00
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: 23bf1b6be9
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
c99c2171fc
commit
ab81dabda1
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user