From 8f2187f416ff90ec7c9f0ff9d9d2abe7de9d8201 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 25 Oct 2012 12:13:57 +1100 Subject: [PATCH] pidns-limit-the-nesting-depth-of-pid-namespaces-fix return -EINVAL in response to excessive nesting, not -ENOMEM Cc: "Eric W. Biederman" Cc: Andrew Vagin Cc: Cyrill Gorcunov Cc: Oleg Nesterov Cc: Pavel Emelyanov Signed-off-by: Andrew Morton --- kernel/pid_namespace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index dd82418c6b59..7b07cc0dfb75 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c @@ -78,11 +78,15 @@ static struct pid_namespace *create_pid_namespace(struct pid_namespace *parent_p { struct pid_namespace *ns; unsigned int level = parent_pid_ns->level + 1; - int i, err = -ENOMEM; + int i; + int err; - if (level > MAX_PID_NS_LEVEL) + if (level > MAX_PID_NS_LEVEL) { + err = -EINVAL; goto out; + } + err = -ENOMEM; ns = kmem_cache_zalloc(pid_ns_cachep, GFP_KERNEL); if (ns == NULL) goto out; -- 2.39.5