__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") Signed-off-by: lllei --- 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 b3b979403..79db8063a 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2215,7 +2215,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; } -- 2.43.0