diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2023-02-21 11:19:49 -0800 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2023-02-21 11:19:49 -0800 |
commit | 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18 (patch) | |
tree | dbdd35328f43569c38c4ce193cefd7d2b6b9fbfd /net/unix/af_unix.c | |
parent | 9c445d2637c938a800fcc8b5f0b10e60c94460c7 (diff) | |
parent | 9e69e845ae95227949c400af1037dca023f73038 (diff) |
Merge branch 'next' into for-linus
Prepare input updates for 6.3 merge window.
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index b3545fc68097..f0c2293f1d3b 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1999,13 +1999,20 @@ restart_locked: unix_state_lock(sk); err = 0; - if (unix_peer(sk) == other) { + if (sk->sk_type == SOCK_SEQPACKET) { + /* We are here only when racing with unix_release_sock() + * is clearing @other. Never change state to TCP_CLOSE + * unlike SOCK_DGRAM wants. + */ + unix_state_unlock(sk); + err = -EPIPE; + } else if (unix_peer(sk) == other) { unix_peer(sk) = NULL; unix_dgram_peer_wake_disconnect_wakeup(sk, other); + sk->sk_state = TCP_CLOSE; unix_state_unlock(sk); - sk->sk_state = TCP_CLOSE; unix_dgram_disconnected(sk, other); sock_put(other); err = -ECONNREFUSED; @@ -3738,6 +3745,7 @@ static int __init af_unix_init(void) rc = proto_register(&unix_stream_proto, 1); if (rc != 0) { pr_crit("%s: Cannot create unix_sock SLAB cache!\n", __func__); + proto_unregister(&unix_dgram_proto); goto out; } |