public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RESEND][PATCH] userns: use marco instead of magic number for max userns level
@ 2014-09-11  9:51 Chen Hanxiao
  2014-09-11 16:30 ` Serge Hallyn
  2014-09-11 18:17 ` Aristeu Rozanski
  0 siblings, 2 replies; 4+ messages in thread
From: Chen Hanxiao @ 2014-09-11  9:51 UTC (permalink / raw)
  To: containers, linux-kernel
  Cc: Eric W. Biederman, Serge Hallyn, Oleg Nesterov, Fabian Frederick

Use marco instead of magic number
for max user namespace level.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
---
 kernel/user_namespace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index aa312b0..5435489 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -47,6 +47,8 @@ static void set_cred_user_ns(struct cred *cred, struct user_namespace *user_ns)
 	cred->user_ns = user_ns;
 }
 
+#define MAX_USER_NS_LEVEL 32
+
 /*
  * Create a new user namespace, deriving the creator from the user in the
  * passed credentials, and replacing that user with the new root user for the
@@ -62,7 +64,7 @@ int create_user_ns(struct cred *new)
 	kgid_t group = new->egid;
 	int ret;
 
-	if (parent_ns->level > 32)
+	if (parent_ns->level > MAX_USER_NS_LEVEL)
 		return -EUSERS;
 
 	/*
-- 
1.9.0


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

end of thread, other threads:[~2014-09-12  1:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11  9:51 [RESEND][PATCH] userns: use marco instead of magic number for max userns level Chen Hanxiao
2014-09-11 16:30 ` Serge Hallyn
2014-09-11 18:17 ` Aristeu Rozanski
2014-09-12  1:54   ` Chen, Hanxiao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox