Skip to content

Commit 927e379

Browse files
q2venSasha Levin
authored andcommitted
af_unix: Use skb_queue_len_lockless() in sk_diag_show_rqlen().
[ Upstream commit 5d915e5 ] 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: c9da99e ("unix_diag: Fixup RQLEN extension report") Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9caf13f commit 927e379

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/unix/diag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static int sk_diag_show_rqlen(struct sock *sk, struct sk_buff *nlskb)
104104
struct unix_diag_rqlen rql;
105105

106106
if (READ_ONCE(sk->sk_state) == TCP_LISTEN) {
107-
rql.udiag_rqueue = sk->sk_receive_queue.qlen;
107+
rql.udiag_rqueue = skb_queue_len_lockless(&sk->sk_receive_queue);
108108
rql.udiag_wqueue = sk->sk_max_ack_backlog;
109109
} else {
110110
rql.udiag_rqueue = (u32) unix_inq_len(sk);

0 commit comments

Comments
 (0)