mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-09 06:14:34 +02:00
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: fd0a109a0f ("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>
21 lines
403 B
Makefile
21 lines
403 B
Makefile
top_srcdir := ../../../../..
|
|
include $(top_srcdir)/scripts/Makefile.compiler
|
|
|
|
cc-option = $(call __cc-option, $(CC),,$(1),$(2))
|
|
|
|
CFLAGS += $(KHDR_INCLUDES) -Wall $(call cc-option,-Wflex-array-member-not-at-end)
|
|
|
|
TEST_GEN_PROGS := \
|
|
diag_uid \
|
|
msg_oob \
|
|
scm_inq \
|
|
scm_pidfd \
|
|
scm_rights \
|
|
so_peek_off \
|
|
unix_connect \
|
|
unix_connreset \
|
|
unix_listen \
|
|
# end of TEST_GEN_PROGS
|
|
|
|
include ../../lib.mk
|