All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 1/2] phonet: take correct lock to peek at the RX queue
@ 2024-02-18  8:12 Rémi Denis-Courmont
  2024-02-22  8:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Rémi Denis-Courmont @ 2024-02-18  8:12 UTC (permalink / raw)
  To: courmisch, davem, edumazet, kuba, pabeni; +Cc: netdev, linux-kernel

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

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>
---
 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 related	[flat|nested] 2+ messages in thread

* Re: [PATCHv2 1/2] phonet: take correct lock to peek at the RX queue
  2024-02-18  8:12 [PATCHv2 1/2] phonet: take correct lock to peek at the RX queue Rémi Denis-Courmont
@ 2024-02-22  8:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-22  8:30 UTC (permalink / raw)
  To: =?utf-8?q?R=C3=A9mi_Denis-Courmont_=3Cremi=40remlab=2Enet=3E?=
  Cc: courmisch, davem, edumazet, kuba, pabeni, netdev, linux-kernel

Hello:

This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Sun, 18 Feb 2024 10:12:13 +0200 you wrote:
> From: Rémi Denis-Courmont <courmisch@gmail.com>
> 
> 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>
> 
> [...]

Here is the summary with links:
  - [PATCHv2,1/2] phonet: take correct lock to peek at the RX queue
    https://git.kernel.org/netdev/net/c/3b2d9bc4d4ac
  - [PATCHv2,2/2] phonet/pep: fix racy skb_queue_empty() use
    https://git.kernel.org/netdev/net/c/7d2a894d7f48

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-02-22  8:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-18  8:12 [PATCHv2 1/2] phonet: take correct lock to peek at the RX queue Rémi Denis-Courmont
2024-02-22  8:30 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.