From: Christian Brauner Date: Tue, 16 Jun 2020 22:33:12 +0000 (+0200) Subject: nsproxy: restore EINVAL for non-namespace file descriptor X-Git-Tag: v5.8-rc3~42^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e571d4ee334719727f22cce30c4c74471d4ef68a;p=thirdparty%2Fkernel%2Flinux.git nsproxy: restore EINVAL for non-namespace file descriptor The LTP testsuite reported a regression where users would now see EBADF returned instead of EINVAL when an fd was passed that referred to an open file but the file was not a nsfd. Fix this by continuing to report EINVAL. Reported-by: kernel test robot Cc: Jan Stancek Cc: Cyril Hrubis Link: https://lore.kernel.org/lkml/20200615085836.GR12456@shao2-debian Fixes: 303cc571d107 ("nsproxy: attach to namespaces via pidfds") Signed-off-by: Christian Brauner --- diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index b03df67621d01..cd356630a311a 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c @@ -531,7 +531,7 @@ SYSCALL_DEFINE2(setns, int, fd, int, flags) } else if (!IS_ERR(pidfd_pid(file))) { err = check_setns_flags(flags); } else { - err = -EBADF; + err = -EINVAL; } if (err) goto out;