* [PATCH net-next] mptcp: avoid potential infinite loop in mptcp_recvmsg()
@ 2020-12-02 17:16 Eric Dumazet
2020-12-02 17:38 ` Paolo Abeni
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Dumazet @ 2020-12-02 17:16 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski
Cc: netdev, Eric Dumazet, Eric Dumazet, Paolo Abeni
From: Eric Dumazet <edumazet@google.com>
If a packet is ready in receive queue, and application isssues
a recvmsg()/recvfrom()/recvmmsg() request asking for zero bytes,
we hang in mptcp_recvmsg().
Fixes: ea4ca586b16f ("mptcp: refine MPTCP-level ack scheduling")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Paolo Abeni <pabeni@redhat.com>
---
net/mptcp/protocol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 221f7cdd416bdb681968bf1b3ff2ed1b03cea3ce..57213ff60f784fae14c2a96f391ccdec6249c168 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1921,7 +1921,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
len = min_t(size_t, len, INT_MAX);
target = sock_rcvlowat(sk, flags & MSG_WAITALL, len);
- for (;;) {
+ while (copied < len) {
int bytes_read, old_space;
bytes_read = __mptcp_recvmsg_mskq(msk, msg, len - copied);
--
2.29.2.454.gaff20da3a2-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] mptcp: avoid potential infinite loop in mptcp_recvmsg()
2020-12-02 17:16 [PATCH net-next] mptcp: avoid potential infinite loop in mptcp_recvmsg() Eric Dumazet
@ 2020-12-02 17:38 ` Paolo Abeni
2020-12-02 19:06 ` Mat Martineau
2020-12-02 20:06 ` Jakub Kicinski
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Abeni @ 2020-12-02 17:38 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski; +Cc: netdev, Eric Dumazet
On Wed, 2020-12-02 at 09:16 -0800, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> If a packet is ready in receive queue, and application isssues
> a recvmsg()/recvfrom()/recvmmsg() request asking for zero bytes,
> we hang in mptcp_recvmsg().
>
> Fixes: ea4ca586b16f ("mptcp: refine MPTCP-level ack scheduling")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Paolo Abeni <pabeni@redhat.com>
Tested-by: Paolo Abeni <pabeni@redhat.com>
Thanks Eric!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] mptcp: avoid potential infinite loop in mptcp_recvmsg()
2020-12-02 17:16 [PATCH net-next] mptcp: avoid potential infinite loop in mptcp_recvmsg() Eric Dumazet
2020-12-02 17:38 ` Paolo Abeni
@ 2020-12-02 19:06 ` Mat Martineau
2020-12-02 20:06 ` Jakub Kicinski
2 siblings, 0 replies; 4+ messages in thread
From: Mat Martineau @ 2020-12-02 19:06 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Jakub Kicinski, netdev, Eric Dumazet,
Paolo Abeni
On Wed, 2 Dec 2020, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> If a packet is ready in receive queue, and application isssues
> a recvmsg()/recvfrom()/recvmmsg() request asking for zero bytes,
> we hang in mptcp_recvmsg().
>
> Fixes: ea4ca586b16f ("mptcp: refine MPTCP-level ack scheduling")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Paolo Abeni <pabeni@redhat.com>
> ---
> net/mptcp/protocol.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Thanks for catching this Eric.
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
--
Mat Martineau
Intel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] mptcp: avoid potential infinite loop in mptcp_recvmsg()
2020-12-02 17:16 [PATCH net-next] mptcp: avoid potential infinite loop in mptcp_recvmsg() Eric Dumazet
2020-12-02 17:38 ` Paolo Abeni
2020-12-02 19:06 ` Mat Martineau
@ 2020-12-02 20:06 ` Jakub Kicinski
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2020-12-02 20:06 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David S . Miller, netdev, Eric Dumazet, Paolo Abeni
On Wed, 2 Dec 2020 09:16:57 -0800 Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> If a packet is ready in receive queue, and application isssues
> a recvmsg()/recvfrom()/recvmmsg() request asking for zero bytes,
> we hang in mptcp_recvmsg().
>
> Fixes: ea4ca586b16f ("mptcp: refine MPTCP-level ack scheduling")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Paolo Abeni <pabeni@redhat.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-02 20:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-02 17:16 [PATCH net-next] mptcp: avoid potential infinite loop in mptcp_recvmsg() Eric Dumazet
2020-12-02 17:38 ` Paolo Abeni
2020-12-02 19:06 ` Mat Martineau
2020-12-02 20:06 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).