diff options
author | Rémi Denis-Courmont <courmisch@gmail.com> | 2024-02-18 09:12:13 +0100 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2024-02-22 09:05:50 +0100 |
commit | 3b2d9bc4d4acdf15a876eae2c0d83149250e85ba (patch) | |
tree | 267d12e819f2b7d709394bf6294327ae6ebb8a1a /net | |
parent | net: sparx5: Add spinlock for frame transmission from CPU (diff) | |
download | linux-3b2d9bc4d4acdf15a876eae2c0d83149250e85ba.tar.xz linux-3b2d9bc4d4acdf15a876eae2c0d83149250e85ba.zip |
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: 107d0d9b8d9a ("Phonet: Phonet datagram transport protocol")
Reported-by: Luosili <rootlab@huawei.com>
Signed-off-by: Rémi Denis-Courmont <courmisch@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20240218081214.4806-1-remi@remlab.net
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/phonet/datagram.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/phonet/datagram.c b/net/phonet/datagram.c index 3aa50dc7535b..976fe250b509 100644 --- a/net/phonet/datagram.c +++ b/net/phonet/datagram.c @@ -34,10 +34,10 @@ static int pn_ioctl(struct sock *sk, int cmd, int *karg) switch (cmd) { case SIOCINQ: - lock_sock(sk); + spin_lock_bh(&sk->sk_receive_queue.lock); skb = skb_peek(&sk->sk_receive_queue); *karg = skb ? skb->len : 0; - release_sock(sk); + spin_unlock_bh(&sk->sk_receive_queue.lock); return 0; case SIOCPNADDRESOURCE: |