mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] phonet: take correct lock to peek at the RX queue
@ 2024-02-10 12:50 Rémi Denis-Courmont
  2024-02-10 12:50 ` [PATCH 2/2] phonet/pep: fix racy skb_queue_empty() use Rémi Denis-Courmont
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Rémi Denis-Courmont @ 2024-02-10 12:50 UTC (permalink / raw)
  To: courmisch, davem, edumazet, kuba, pabeni; +Cc: netdev, linux-kernel

From: Rémi Denis-Courmont <courmisch@gmail.com>

Reported-by: Luosili <rootlab@huawei.com>
Signed-off-by: Rémi Denis-Courmont <courmisch@gmail.com>
---
 net/phonet/datagram.c | 4 ++--
 1 file 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:
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-13 12:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-10 12:50 [PATCH 1/2] phonet: take correct lock to peek at the RX queue Rémi Denis-Courmont
2024-02-10 12:50 ` [PATCH 2/2] phonet/pep: fix racy skb_queue_empty() use Rémi Denis-Courmont
2024-02-13 12:14   ` Paolo Abeni
2024-02-12  9:34 ` [PATCH 1/2] phonet: take correct lock to peek at the RX queue Eric Dumazet
2024-02-13 12:12 ` Paolo Abeni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®