Skip to content

Commit

Permalink
nsproxy: restore EINVAL for non-namespace file descriptor
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Christian Brauner committed Jun 16, 2020
1 parent b3a9e3b commit e571d4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/nsproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e571d4e

Please sign in to comment.