Skip to content

Commit 46cf047

Browse files
author
Al Viro
committed
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>
1 parent 709a643 commit 46cf047

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎fs/proc/root.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ static int proc_get_tree(struct fs_context *fc)
157157
{
158158
struct proc_fs_context *ctx = fc->fs_private;
159159

160-
put_user_ns(fc->user_ns);
161-
fc->user_ns = get_user_ns(ctx->pid_ns->user_ns);
162160
fc->s_fs_info = ctx->pid_ns;
163161
return vfs_get_super(fc, vfs_get_keyed_super, proc_fill_super);
164162
}
@@ -167,8 +165,7 @@ static void proc_fs_context_free(struct fs_context *fc)
167165
{
168166
struct proc_fs_context *ctx = fc->fs_private;
169167

170-
if (ctx->pid_ns)
171-
put_pid_ns(ctx->pid_ns);
168+
put_pid_ns(ctx->pid_ns);
172169
kfree(ctx);
173170
}
174171

@@ -188,6 +185,8 @@ static int proc_init_fs_context(struct fs_context *fc)
188185
return -ENOMEM;
189186

190187
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);
191190
fc->fs_private = ctx;
192191
fc->ops = &proc_fs_context_ops;
193192
return 0;

0 commit comments

Comments
 (0)