diff options
author | David Rheinsberg <david@readahead.eu> | 2023-08-07 10:12:25 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-08-08 15:56:48 -0700 |
commit | b6f79e826fbd26e91e2fb28070484634cacdeb26 (patch) | |
tree | 1272ca9265b2169cb0f4d588f83d1cb3fd8c3820 /drivers/macintosh/windfarm_cpufreq_clamp.c | |
parent | fa40ea27ede397cb19b8cb264f136db9c43c6f7e (diff) | |
download | linux-stable-b6f79e826fbd26e91e2fb28070484634cacdeb26.tar.gz linux-stable-b6f79e826fbd26e91e2fb28070484634cacdeb26.tar.bz2 linux-stable-b6f79e826fbd26e91e2fb28070484634cacdeb26.zip |
net/unix: use consistent error code in SO_PEERPIDFD
Change the new (unreleased) SO_PEERPIDFD sockopt to return ENODATA
rather than ESRCH if a socket type does not support remote peer-PID
queries.
Currently, SO_PEERPIDFD returns ESRCH when the socket in question is
not an AF_UNIX socket. This is quite unexpected, given that one would
assume ESRCH means the peer process already exited and thus cannot be
found. However, in that case the sockopt actually returns EINVAL (via
pidfd_prepare()). This is rather inconsistent with other syscalls, which
usually return ESRCH if a given PID refers to a non-existant process.
This changes SO_PEERPIDFD to return ENODATA instead. This is also what
SO_PEERGROUPS returns, and thus keeps a consistent behavior across
sockopts.
Note that this code is returned in 2 cases: First, if the socket type is
not AF_UNIX, and secondly if the socket was not yet connected. In both
cases ENODATA seems suitable.
Signed-off-by: David Rheinsberg <david@readahead.eu>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Acked-by: Luca Boccassi <bluca@debian.org>
Fixes: 7b26952a91cf ("net: core: add getsockopt SO_PEERPIDFD")
Link: https://lore.kernel.org/r/20230807081225.816199-1-david@readahead.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/macintosh/windfarm_cpufreq_clamp.c')
0 files changed, 0 insertions, 0 deletions