Skip to content

Commit 3b2d9bc

Browse files
Rémi Denis-CourmontPaolo Abeni
authored andcommitted
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: 107d0d9 ("Phonet: Phonet datagram transport protocol") Reported-by: Luosili <[email protected]> Signed-off-by: Rémi Denis-Courmont <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 603ead9 commit 3b2d9bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/phonet/datagram.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ static int pn_ioctl(struct sock *sk, int cmd, int *karg)
3434

3535
switch (cmd) {
3636
case SIOCINQ:
37-
lock_sock(sk);
37+
spin_lock_bh(&sk->sk_receive_queue.lock);
3838
skb = skb_peek(&sk->sk_receive_queue);
3939
*karg = skb ? skb->len : 0;
40-
release_sock(sk);
40+
spin_unlock_bh(&sk->sk_receive_queue.lock);
4141
return 0;
4242

4343
case SIOCPNADDRESOURCE:

0 commit comments

Comments
 (0)