[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241126175402.1506-1-ffmancera@riseup.net>
Date: Tue, 26 Nov 2024 17:53:15 +0000
From: Fernando Fernandez Mancera <ffmancera@...eup.net>
To: netdev@...r.kernel.org
Cc: edumazet@...gle.com,
willemb@...gle.com,
Fernando Fernandez Mancera <ffmancera@...eup.net>
Subject: [PATCH net] udp: call sock_def_readable() if socket is not SOCK_FASYNC
If a socket is not SOCK_FASYNC, sock_def_readable() needs to be called
even if receive queue was not empty. Otherwise, if several threads are
listening on the same socket with blocking recvfrom() calls they might
hang waiting for data to be received.
Link: https://bugzilla.redhat.com/2308477
Fixes: 612b1c0dec5b ("udp: avoid calling sock_def_readable() if possible")
Signed-off-by: Fernando Fernandez Mancera <ffmancera@...eup.net>
---
net/ipv4/udp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 6a01905d379f..4c398e6945ee 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1722,6 +1722,7 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)
if (!sock_flag(sk, SOCK_DEAD)) {
if (becomes_readable ||
sk->sk_data_ready != sock_def_readable ||
+ !sock_flag(sk, SOCK_FASYNC) ||
READ_ONCE(sk->sk_peek_off) >= 0)
INDIRECT_CALL_1(sk->sk_data_ready,
sock_def_readable, sk);
--
2.47.1
Powered by blists - more mailing lists