]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mptcp: refine memory scheduling
authorPaolo Abeni <pabeni@redhat.com>
Thu, 30 Jun 2022 22:17:56 +0000 (15:17 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:42:34 +0000 (14:42 +0200)
commit 69d93daec026cdda98e29e8edb12534bfa5b1a9b upstream.

Similar to commit 7c80b038d23e ("net: fix sk_wmem_schedule() and
sk_rmem_schedule() errors"), let the MPTCP receive path schedule
exactly the required amount of memory.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/mptcp/protocol.c

index 07b5a2044cab424cd084f4099ba6e2227356511e..9c25e6a9a2795662f163be2ddd26b536f417c324 100644 (file)
@@ -323,9 +323,10 @@ static bool mptcp_rmem_schedule(struct sock *sk, struct sock *ssk, int size)
        struct mptcp_sock *msk = mptcp_sk(sk);
        int amt, amount;
 
-       if (size < msk->rmem_fwd_alloc)
+       if (size <= msk->rmem_fwd_alloc)
                return true;
 
+       size -= msk->rmem_fwd_alloc;
        amt = sk_mem_pages(size);
        amount = amt << SK_MEM_QUANTUM_SHIFT;
        msk->rmem_fwd_alloc += amount;