I still wonder if we need to actually recheck the condition and notsock destroy(sic) is called before sock_orphan which sets SOCK_DEAD, so the receive queue has already been drained.
simply break out of unix_stream_data_wait:
We return to the unix_stream_recvmsg loop and recheck the
sk_receive_queue. At this point sk_receive_queue is not really protected
with unix_state_lock against concurrent modification with unix_release,
as such we could end up concurrently dequeueing packets if socket is
DEAD.