]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
pidns-limit-the-nesting-depth-of-pid-namespaces-fix
authorAndrew Morton <akpm@linux-foundation.org>
Thu, 25 Oct 2012 01:13:57 +0000 (12:13 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 25 Oct 2012 01:13:57 +0000 (12:13 +1100)
return -EINVAL in response to excessive nesting, not -ENOMEM

Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andrew Vagin <avagin@openvz.org>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/pid_namespace.c

index dd82418c6b59c98d66d53483028dc563cb82e348..7b07cc0dfb75fb6b2f2f802178abf82565d9c1a4 100644 (file)
@@ -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;