]> www.infradead.org Git - users/hch/xfs.git/commitdiff
af_unix: Use skb_queue_len_lockless() in sk_diag_show_rqlen().
authorKuniyuki Iwashima <kuniyu@amazon.com>
Tue, 4 Jun 2024 16:52:40 +0000 (09:52 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 6 Jun 2024 10:57:15 +0000 (12:57 +0200)
We can dump the socket queue length via UNIX_DIAG by specifying
UDIAG_SHOW_RQLEN.

If sk->sk_state is TCP_LISTEN, we return the recv queue length,
but here we do not hold recvq lock.

Let's use skb_queue_len_lockless() in sk_diag_show_rqlen().

Fixes: c9da99e6475f ("unix_diag: Fixup RQLEN extension report")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/unix/diag.c

index 116cf508aea4abc8d2e87ddd254e982bb3928f1b..321336f91a0afb22e75be21da6c5fd50f12d2198 100644 (file)
@@ -104,7 +104,7 @@ static int sk_diag_show_rqlen(struct sock *sk, struct sk_buff *nlskb)
        struct unix_diag_rqlen rql;
 
        if (READ_ONCE(sk->sk_state) == TCP_LISTEN) {
-               rql.udiag_rqueue = sk->sk_receive_queue.qlen;
+               rql.udiag_rqueue = skb_queue_len_lockless(&sk->sk_receive_queue);
                rql.udiag_wqueue = sk->sk_max_ack_backlog;
        } else {
                rql.udiag_rqueue = (u32) unix_inq_len(sk);