summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2019-05-12 18:10:24 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2019-05-25 18:00:00 -0400
commit46cf047a945c7a53cb2dc9353a87a9a4e3e778cd (patch)
treef7dcda6f043952e36cbd62c9b57ed4d34cf8d5b5
parent709a643da8b8c5fc823e1870d8227ca0eeb51311 (diff)
procfs: set ->user_ns before calling ->get_tree()
here it's even simpler than in mqueue - pid_ns_prepare_proc() does everything needed anyway. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/proc/root.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 8b145e7b9661..74c2c6ab10bd 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -157,8 +157,6 @@ static int proc_get_tree(struct fs_context *fc)
157{ 157{
158 struct proc_fs_context *ctx = fc->fs_private; 158 struct proc_fs_context *ctx = fc->fs_private;
159 159
160 put_user_ns(fc->user_ns);
161 fc->user_ns = get_user_ns(ctx->pid_ns->user_ns);
162 fc->s_fs_info = ctx->pid_ns; 160 fc->s_fs_info = ctx->pid_ns;
163 return vfs_get_super(fc, vfs_get_keyed_super, proc_fill_super); 161 return vfs_get_super(fc, vfs_get_keyed_super, proc_fill_super);
164} 162}
@@ -167,8 +165,7 @@ static void proc_fs_context_free(struct fs_context *fc)
167{ 165{
168 struct proc_fs_context *ctx = fc->fs_private; 166 struct proc_fs_context *ctx = fc->fs_private;
169 167
170 if (ctx->pid_ns) 168 put_pid_ns(ctx->pid_ns);
171 put_pid_ns(ctx->pid_ns);
172 kfree(ctx); 169 kfree(ctx);
173} 170}
174 171
@@ -188,6 +185,8 @@ static int proc_init_fs_context(struct fs_context *fc)
188 return -ENOMEM; 185 return -ENOMEM;
189 186
190 ctx->pid_ns = get_pid_ns(task_active_pid_ns(current)); 187 ctx->pid_ns = get_pid_ns(task_active_pid_ns(current));
188 put_user_ns(fc->user_ns);
189 fc->user_ns = get_user_ns(ctx->pid_ns->user_ns);
191 fc->fs_private = ctx; 190 fc->fs_private = ctx;
192 fc->ops = &proc_fs_context_ops; 191 fc->ops = &proc_fs_context_ops;
193 return 0; 192 return 0;