[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200317103334.271538396@linuxfoundation.org>
Date: Tue, 17 Mar 2020 11:55:20 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Corey Minyard <cminyard@...sta.com>,
Christian Brauner <christian.brauner@...ntu.com>,
Andrei Vagin <avagin@...il.com>,
Dmitry Safonov <0x7f454c46@...il.com>,
Oleg Nesterov <oleg@...hat.com>,
Adrian Reber <areber@...hat.com>
Subject: [PATCH 5.5 110/151] pid: Fix error return value in some cases
From: Corey Minyard <cminyard@...sta.com>
commit b26ebfe12f34f372cf041c6f801fa49c3fb382c5 upstream.
Recent changes to alloc_pid() allow the pid number to be specified on
the command line. If set_tid_size is set, then the code scanning the
levels will hard-set retval to -EPERM, overriding it's previous -ENOMEM
value.
After the code scanning the levels, there are error returns that do not
set retval, assuming it is still set to -ENOMEM.
So set retval back to -ENOMEM after scanning the levels.
Fixes: 49cb2fc42ce4 ("fork: extend clone3() to support setting a PID")
Signed-off-by: Corey Minyard <cminyard@...sta.com>
Acked-by: Christian Brauner <christian.brauner@...ntu.com>
Cc: Andrei Vagin <avagin@...il.com>
Cc: Dmitry Safonov <0x7f454c46@...il.com>
Cc: Oleg Nesterov <oleg@...hat.com>
Cc: Adrian Reber <areber@...hat.com>
Cc: <stable@...r.kernel.org> # 5.5
Link: https://lore.kernel.org/r/20200306172314.12232-1-minyard@acm.org
[christian.brauner@...ntu.com: fixup commit message]
Signed-off-by: Christian Brauner <christian.brauner@...ntu.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
kernel/pid.c | 2 ++
1 file changed, 2 insertions(+)
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -247,6 +247,8 @@ struct pid *alloc_pid(struct pid_namespa
tmp = tmp->parent;
}
+ retval = -ENOMEM;
+
if (unlikely(is_child_reaper(pid))) {
if (pid_ns_prepare_proc(ns))
goto out_free;
Powered by blists - more mailing lists