fix sysfs_init_fs_context() in !CONFIG_NET_NS case
[linux-2.6-block.git] / fs / sysfs / mount.c
index 4cb21b558a856188de12cb33d5b0bba4a85fb551..1b56686ab178dc6d4363ea2f76fde6cff90926da 100644 (file)
@@ -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;
 }