mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
af_unix: fix listen() succeeding on sockets in the wrong state
Commitfd0a109a0f("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: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-1-John.Ericson@Obsidian.Systems Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
4787a6d262
commit
f0d9c3ffc2
@@ -823,6 +823,7 @@ static int unix_listen(struct socket *sock, int backlog)
|
||||
if (err)
|
||||
goto out;
|
||||
unix_state_lock(sk);
|
||||
err = -EINVAL;
|
||||
if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN)
|
||||
goto out_unlock;
|
||||
if (backlog > sk->sk_max_ack_backlog)
|
||||
|
||||
Reference in New Issue
Block a user