Commit 0d4d7937 authored by Paolo Abeni's avatar Paolo Abeni Committed by ZhangPeng
Browse files

mptcp: fix bad RCVPRUNED mib accounting

stable inclusion
from stable-v6.6.45
commit 19bf32929bc0991c6107f85fd5030824c6e9465e
bugzilla: https://gitee.com/openeuler/kernel/issues/IAJEIR

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=19bf32929bc0991c6107f85fd5030824c6e9465e



--------------------------------

commit 0a567c2a10033bf04ed618368d179bce6977984b upstream.

Since its introduction, the mentioned MIB accounted for the wrong
event: wake-up being skipped as not-needed on some edge condition
instead of incoming skb being dropped after landing in the (subflow)
receive queue.

Move the increment in the correct location.

Fixes: ce599c51 ("mptcp: properly account bulk freed memory")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
parent 19285a98
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -350,8 +350,10 @@ static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk,
	skb_orphan(skb);

	/* try to fetch required memory from subflow */
	if (!mptcp_rmem_schedule(sk, ssk, skb->truesize))
	if (!mptcp_rmem_schedule(sk, ssk, skb->truesize)) {
		MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED);
		goto drop;
	}

	has_rxtstamp = TCP_SKB_CB(skb)->has_rxtstamp;

@@ -842,10 +844,8 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk)
		sk_rbuf = ssk_rbuf;

	/* over limit? can't append more skbs to msk, Also, no need to wake-up*/
	if (__mptcp_rmem(sk) > sk_rbuf) {
		MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED);
	if (__mptcp_rmem(sk) > sk_rbuf)
		return;
	}

	/* Wake-up the reader only for in-sequence data */
	mptcp_data_lock(sk);