* [PATCH net v2] mptcp: exclude MSG_PEEK from receive buffer autotuning
@ 2026-11-20 7:54 Lin Lei
2026-11-20 7:57 ` netdev-bot+sinfo
0 siblings, 1 reply; 2+ messages in thread
From: Lin Lei @ 2026-11-20 7:54 UTC (permalink / raw)
To: netdev, mptcp
Cc: matttbe, martineau, geliang, davem, edumazet, kuba, pabeni,
willemb, horms
__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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net v2] mptcp: exclude MSG_PEEK from receive buffer autotuning
2026-11-20 7:54 [PATCH net v2] mptcp: exclude MSG_PEEK from receive buffer autotuning Lin Lei
@ 2026-11-20 7:57 ` netdev-bot+sinfo
0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-20 7:57 UTC (permalink / raw)
To: Lin Lei
Cc: netdev, mptcp, matttbe, martineau, geliang, davem, edumazet, kuba,
pabeni, willemb, horms
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-20 7:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 7:54 [PATCH net v2] mptcp: exclude MSG_PEEK from receive buffer autotuning Lin Lei
2026-11-20 7:57 ` netdev-bot+sinfo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox