Subject: [Q] why do we ever try to call unix_dgram_peer_wake_disconnect() for SOCK_STREAM?

From: Al Viro <[email-masked]>
Date: Sun, 24 Feb 2019 06:28:12 +0000

What's the point of calling unix_dgram_peer_wake_disconnect() in
unix_release_sock() of SOCK_STREAM/SOCK_SEQPACKET sockets?  AFAICS,
for those we never call unix_dgram_peer_wake_connect(), i.e. ->peer_wake.private
of any non-SOCK_DGRAM socker has to remain NULL.  Which makes that call simply
	spin_lock(&unix_sk(skpair)->peer_wait.lock);
	spin_unlock(&unix_sk(skpair)->peer_wait.lock);
and that doesn't even serve as a barrier for anything else.  Should that
have been
                if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) {
                        unix_state_lock(skpair);
                        /* No more writes */
                        skpair->sk_shutdown = SHUTDOWN_MASK;
                        if (!skb_queue_empty(&sk->sk_receive_queue) || embrion)
                                skpair->sk_err = ECONNRESET;
                        unix_state_unlock(skpair);
                        skpair->sk_state_change(skpair);
                        sk_wake_async(skpair, SOCK_WAKE_WAITD, POLL_HUP);
                } else {
			unix_dgram_peer_wake_disconnect(sk, skpair);
		}
or am I missing something subtle here?