Skip to content

Commit e571d4e

Browse files
author
Christian Brauner
committed
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 <[email protected]> Cc: Jan Stancek <[email protected]> Cc: Cyril Hrubis <[email protected]> Link: https://lore.kernel.org/lkml/20200615085836.GR12456@shao2-debian Fixes: 303cc57 ("nsproxy: attach to namespaces via pidfds") Signed-off-by: Christian Brauner <[email protected]>
1 parent b3a9e3b commit e571d4e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/nsproxy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ SYSCALL_DEFINE2(setns, int, fd, int, flags)
531531
} else if (!IS_ERR(pidfd_pid(file))) {
532532
err = check_setns_flags(flags);
533533
} else {
534-
err = -EBADF;
534+
err = -EINVAL;
535535
}
536536
if (err)
537537
goto out;

0 commit comments

Comments
 (0)