linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH dhowells/mount-api] proc: set a proper user namespace for fs_context
@ 2018-08-16  7:34 Andrei Vagin
  2018-08-16 22:16 ` Andrei Vagin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrei Vagin @ 2018-08-16  7:34 UTC (permalink / raw)
  To: David Howells; +Cc: linux-fsdevel, Andrei Vagin, Andrei Vagin

A user namespace should be taken from a pidns for which a procfs is created.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
---
 fs/proc/root.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/proc/root.c b/fs/proc/root.c
index 1d6e5bfa30cc..1419b48a89ab 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -315,6 +315,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.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-21 10:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-16  7:34 [PATCH dhowells/mount-api] proc: set a proper user namespace for fs_context Andrei Vagin
2018-08-16 22:16 ` Andrei Vagin
2018-08-21  7:33 ` David Howells
2018-08-21  7:39 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).