blob: a4003d5a1a4207802f26ecb830bf9f44ea4ee80a [file] [log] [blame]
From 92ebeb66d854abd86c24033db5b972d6ab5bf889 Mon Sep 17 00:00:00 2001
From: Paolo Abeni <pabeni@redhat.com>
Date: Tue, 21 Jan 2020 16:50:49 +0100
Subject: [PATCH] Revert "udp: do rmem bulk free even if the rx sk queue is
empty"
commit d39ca2590d10712f412add7a88e1dd467a7246f4 upstream.
This reverts commit 0d4a6608f68c7532dcbfec2ea1150c9761767d03.
Williem reported that after commit 0d4a6608f68c ("udp: do rmem bulk
free even if the rx sk queue is empty") the memory allocated by
an almost idle system with many UDP sockets can grow a lot.
For stable kernel keep the solution as simple as possible and revert
the offending commit.
Reported-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Diagnosed-by: Eric Dumazet <eric.dumazet@gmail.com>
Fixes: 0d4a6608f68c ("udp: do rmem bulk free even if the rx sk queue is empty")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index e2acad68d9ff..6fe14862e55b 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1363,7 +1363,8 @@ static void udp_rmem_release(struct sock *sk, int size, int partial,
if (likely(partial)) {
up->forward_deficit += size;
size = up->forward_deficit;
- if (size < (sk->sk_rcvbuf >> 2))
+ if (size < (sk->sk_rcvbuf >> 2) &&
+ !skb_queue_empty(&up->reader_queue))
return;
} else {
size += up->forward_deficit;
--
2.7.4