🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Lin Lei Fri, 20 Nov 2026 07:54
[PATCH net v2] mptcp: exclude MSG_PEEK from receive buffer autotuning
#19681
Author: Lin Lei
Date: Fri, 20 Nov 2026 07:54
51 lines
12296 bytes
__mptcp_recvmsg_mskq() passes bytes copied by MSG_PEEK to
mptcp_rcv_space_adjust(), although those bytes remain in the receive
queue. Repeated peeks count the same data as new application
consumption and can inflate the receive-memory budget. Subtracting the
unread queue at a measurement boundary cannot undo that repeated count.

The receive path originally skipped this adjustment for MSG_PEEK.
Commit 581302298524 ("mptcp: error out earlier on disconnect") moved
the adjustment calls without preserving that check.

Only adjust receive space for non-peeking reads. Keep the returned
byte count unchanged.

A loopback test leaves a fixed 32 KiB queue unread and peeks 4096 times.
Before this change, sk_rcvbuf grows to the configured 8 MiB limit.
Afterwards, both the budget and the queue remain unchanged, and a
subsequent consuming read returns the original data intact.

Fixes: 581302298524 ("mptcp: error out earlier on disconnect")
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Lin Lei <llleigoing@gmail.com>
---
Changes in v2:
- Send this fix separately from the other patches.
- Update the author and sign-off and add the Reviewed-by tags.

v1: https://lore.kernel.org/all/20261117052200.1507847-4-llleigoing@outlook.com/

 net/mptcp/protocol.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index b375da1f17fed..ca0ebcf11e02c 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2216,7 +2216,8 @@ static int __mptcp_recvmsg_mskq(struct sock *sk, struct msghdr *msg,
 			break;
 	}
 
-	mptcp_rcv_space_adjust(msk, copied);
+	if (!(flags & MSG_PEEK))
+		mptcp_rcv_space_adjust(msk, copied);
 	return copied;
 }
 

base-commit: 4d67cf2fd2352f130c42494a933ba9158b925c65
-- 
2.43.0
Re: [PATCH net v2] mptcp: exclude MSG_PEEK from receive buffer autotuning
#19683
Author: netdev-bot+sinfo
Date: Fri, 20 Nov 2026 07:57
19 lines
8407 bytes
Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads