summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Ericson <mail@johnericson.me>2026-07-18 14:29:02 -0400
committerJakub Kicinski <kuba@kernel.org>2026-07-24 15:10:05 -0700
commit7f57c650d08b8793bb551bdb33ad876535ef9fe8 (patch)
tree09835c237239aa789772dd989160d659875896b2 /include
parentf0d9c3ffc2b5fc2ffacb56b3036155ce7a940a12 (diff)
selftests/net/af_unix: test listen() rejects wrong socket states
Add a regression test for the unix_listen() state check. The key case is listen() on a bound socket that has already been connected: it is no longer in TCP_CLOSE or TCP_LISTEN, so it must fail with EINVAL. A prepare_peercred() call slipped in ahead of that check once left err at 0 and made listen() silently succeed there instead; this guards against a repeat. The neighbouring outcomes are covered too so they cannot regress the same way: a bound socket in TCP_CLOSE listens fine, calling listen() again on a socket already in TCP_LISTEN is allowed, and an unbound socket fails with EINVAL. Each case runs for both listenable socket types (SOCK_STREAM and SOCK_SEQPACKET) and both pathname and abstract addresses. Fixes: fd0a109a0f6b ("net, pidfs: prepare for handing out pidfds for reaped sk->sk_peer_pid") Signed-off-by: John Ericson <mail@johnericson.me> Link: https://patch.msgid.link/20260718182903.2295560-2-John.Ericson@Obsidian.Systems Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions