Re: [PATCH net v2 1/3] af_unix: fix listen() succeeding on sockets in the wrong state
From: Christian Brauner <brauner@kernel.org>
Date: 2026-07-03 13:17:56
Also in:
lkml
From: Christian Brauner <brauner@kernel.org>
Date: 2026-07-03 13:17:56
Also in:
lkml
Commit fd0a109a0f6b ("net, pidfs: prepare for handing out pidfds for
reaped sk->sk_peer_pid") inserted a `prepare_peercred()` call between
`err = -EINVAL` and the socket-state check in `unix_listen()`. Since
`prepare_peercred()` leaves `err` at 0 on success, `listen()` on an
AF_UNIX socket that is not in `TCP_CLOSE` or `TCP_LISTEN` state (e.g.
one that is already connected) now silently returns success without
doing anything, instead of failing with `EINVAL` as it did before.
Fixes: fd0a109a0f6b ("net, pidfs: prepare for handing out pidfds for reaped sk->sk_peer_pid")
Signed-off-by: John Ericson <redacted>Reviewed-by: Christian Brauner (Amutable) <brauner@kernel.org> -- Christian Brauner [off-list ref]