>From 2297ffb333a7bcee466a5273a3fc84202b9695a6 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 27 Jun 2018 22:45:43 -0700 Subject: [PATCH] proc: set a proper user namespace for fs_context A user namespace should be taken from a pidns for which a procfs is created. Signed-off-by: Andrei Vagin --- fs/proc/root.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/proc/root.c b/fs/proc/root.c index efbdc08a3c86..59aaf06a40c7 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -303,6 +303,11 @@ int pid_ns_prepare_proc(struct pid_namespace *ns) if (IS_ERR(fc)) return PTR_ERR(fc); + if (fc->user_ns != ns->user_ns) { + put_user_ns(fc->user_ns); + fc->user_ns = get_user_ns(ns->user_ns); + } + ctx = fc->fs_private; if (ctx->pid_ns != ns) { put_pid_ns(ctx->pid_ns); -- 2.17.0