projects/linux·commit 92497350

Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

92497350 · Linus Torvalds <[email protected]> · 2019-03-16 10:31:02 -07:00

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
Commit
924973508bf15f2cabbbef7b5c428131fbbd812b
Parents
9c7dc824 · ab81dabd

Merge commit. Changes below are compared with the first parent: 9c7dc824.

Changes

1 files changed · +5 −3

FileStatusAddDelContent
fs/sysfs/mount.cmodified+5−3View file

fs/sysfs/mount.c

View file
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 4cb21b5..1b56686 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;
}