Commit 3b2d9bc4 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Paolo Abeni

phonet: take correct lock to peek at the RX queue

The receive queue is protected by its embedded spin-lock, not the
socket lock, so we need the former lock here (and only that one).

Fixes: 107d0d9b ("Phonet: Phonet datagram transport protocol")
Reported-by: default avatarLuosili <rootlab@huawei.com>
Signed-off-by: default avatarRémi Denis-Courmont <courmisch@gmail.com>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20240218081214.4806-1-remi@remlab.netSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 603ead96
...@@ -34,10 +34,10 @@ static int pn_ioctl(struct sock *sk, int cmd, int *karg) ...@@ -34,10 +34,10 @@ static int pn_ioctl(struct sock *sk, int cmd, int *karg)
switch (cmd) { switch (cmd) {
case SIOCINQ: case SIOCINQ:
lock_sock(sk); spin_lock_bh(&sk->sk_receive_queue.lock);
skb = skb_peek(&sk->sk_receive_queue); skb = skb_peek(&sk->sk_receive_queue);
*karg = skb ? skb->len : 0; *karg = skb ? skb->len : 0;
release_sock(sk); spin_unlock_bh(&sk->sk_receive_queue.lock);
return 0; return 0;
case SIOCPNADDRESOURCE: case SIOCPNADDRESOURCE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment