2024-02-10 12:57:04

by Rémi Denis-Courmont

[permalink] [raw]
Subject: [PATCH 1/2] phonet: take correct lock to peek at the RX queue

From: Rémi Denis-Courmont <[email protected]>

Reported-by: Luosili <[email protected]>
Signed-off-by: Rémi Denis-Courmont <[email protected]>
---
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



2024-02-12 09:36:00

by Eric Dumazet

[permalink] [raw]
Subject: Re: [PATCH 1/2] phonet: take correct lock to peek at the RX queue

On Sat, Feb 10, 2024 at 1:50 PM Rémi Denis-Courmont <[email protected]> wrote:
>
> From: Rémi Denis-Courmont <[email protected]>
>
> Reported-by: Luosili <[email protected]>
> Signed-off-by: Rémi Denis-Courmont <[email protected]>
> ---
> net/phonet/datagram.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>

Fixes: 107d0d9b8d9a ("Phonet: Phonet datagram transport protocol")
Reviewed-by: Eric Dumazet <[email protected]>

Thanks.

2024-02-13 12:21:39

by Paolo Abeni

[permalink] [raw]
Subject: Re: [PATCH 1/2] phonet: take correct lock to peek at the RX queue

On Sat, 2024-02-10 at 14:50 +0200, Rémi Denis-Courmont wrote:
> From: Rémi Denis-Courmont <[email protected]>
>
> Reported-by: Luosili <[email protected]>
> Signed-off-by: Rémi Denis-Courmont <[email protected]>

Looks good, but you need to add a non empty commit message. Even
something quite similar to the one included in patch 2/2.

you can retain Eric's ack when post v2.

Pleas also include the correct fixes tag.

Thanks

Paolo