FROMGIT: proc: Fix broken error paths for namespace links

commit 425224c2d700391729be7fe6929a88ef4e2d7a4e upstream.

Don't return the return value of down_read_killable() (0) when a ptrace
access check fails, return -EACCES as intended.

Reported-by: Magnus Lindholm <linmag7@gmail.com>
Closes: https://lore.kernel.org/r/20260706170735.2941493-1-linmag7@gmail.com
Fixes: 6650527444da ("proc: protect ptrace_may_access() with exec_update_lock (part 1)")
Cc: stable@vger.kernel.org
Signed-off-by: Jann Horn <jannh@google.com>
Link: https://patch.msgid.link/20260706-procfs-ns-eacces-fix-v1-1-a69ab14c02e6@google.com
Tested-by: Magnus Lindholm <linmag7@gmail.com>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 81818151cd228a30af961c1409149f6e0c78513a
 https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux.git linux-6.1.y)

BUG=b:542900253
TEST=cq

Change-Id: Id6b91e769bbb60e27161fcb0ed0052d7c164652e
Disallow-Recycled-Builds: test-failures
Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/8276235
Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Jędrzej Ciupis <jciupis@google.com>
1 file changed