From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50B1F2E8DEB; Sat, 17 Oct 2026 17:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792256762; cv=none; b=aP+rWTIwigdIUuPGC6uATfOl0I3QXsC2hwUuF6rK9vn6w2LgxEqfVGtEMrRThJel748e+bnqR/Yl03GMzErEkXsPNCKudnlwz96moB2G95H4DrAc2/enfsnYqfHC9hsE60HYqpRyjTo0eAtfip1pXLqUBCzTv/KgGAgjRfhUT1w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792256762; c=relaxed/simple; bh=1Xby12UqRbGgPx25JU64IeuGasAcjnEVaDCkB71cjcc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JoE4ofopWh+B642c57s8vdvXoaSFfEb9eCPmNgWBBg6TW1ScEdkHesTHxvQIJoyznKFJ4i+CYw9b3TJmSSO+Av2+PPrDGRtQed53lsc5XqrKHqgIFjVo74+5i32X1iwDYyF722ElDcRxfKWAFp6DkU08a3vpMvm9g8LJGcnXtFU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Y2epK5c5; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Y2epK5c5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBBAB1F000C4; Sat, 17 Oct 2026 17:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792256760; bh=Wx6QWUOEdrD8WBg9bRjg2DN/G8W4Cdno/r8BriSv9W4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Y2epK5c5EmJdqOiaGF9bT6DGopRJ1D/KnXsyIvzyJ2d005EYM17IDpcFzz3s5V+JL sEP+YaMwfJ/bezB2r8SsTOW63Op1RSI5EnAeM4vd1ZBEFk4D9Zs3pACunqdZYqltpj JT9sgsGZz0wI2wuZr8oKvPdvyFJdFJ7Ryox5YjK0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vega , Julian Anastasov , Zhiling Zou , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 6.6 0301/1674] ipvs: bound LBLCR and LBLC cache growth Date: Sat, 17 Oct 2026 17:42:53 +0200 Message-ID: <20261017160438.845542732@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhiling Zou [ Upstream commit 2a3c3de660f96865f303fd25f1285f2ffbfd521d ] ip_vs_lblcr_new() and ip_vs_lblc_new() create cache entries for every previously unseen destination address. The table max_size only tells the periodic collector to reclaim entries after the cache has already exceeded the limit. It does not reclaim entries that the attacker continues to use. Reject new cache entries once either table reaches max_size * 3 / 2. The extra headroom lets the periodic collector catch up while the existing scheduler fallback continues to use the selected destination when cache creation fails. New traffic therefore stays serviceable without growing the tables further. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reported-by: Vega Suggested-by: Julian Anastasov Signed-off-by: Zhiling Zou Acked-by: Julian Anastasov Signed-off-by: Pablo Neira Ayuso [ sashal: Retained kmalloc() instead of kmalloc_obj(). ] Signed-off-by: Sasha Levin --- net/netfilter/ipvs/ip_vs_lblc.c | 3 +++ net/netfilter/ipvs/ip_vs_lblcr.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c index 521e68603d14e..cfe0c0a3e2cfd 100644 --- a/net/netfilter/ipvs/ip_vs_lblc.c +++ b/net/netfilter/ipvs/ip_vs_lblc.c @@ -207,6 +207,9 @@ ip_vs_lblc_new(struct ip_vs_lblc_table *tbl, const union nf_inet_addr *daddr, ip_vs_lblc_del(en); atomic_dec(&tbl->entries); } + if (atomic_read(&tbl->entries) >= tbl->max_size * 3 / 2) + return NULL; + en = kmalloc(sizeof(*en), GFP_ATOMIC); if (!en) return NULL; diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c index 6b582be087785..9c471a14e3d06 100644 --- a/net/netfilter/ipvs/ip_vs_lblcr.c +++ b/net/netfilter/ipvs/ip_vs_lblcr.c @@ -365,6 +365,9 @@ ip_vs_lblcr_new(struct ip_vs_lblcr_table *tbl, const union nf_inet_addr *daddr, en = ip_vs_lblcr_get(af, tbl, daddr); if (!en) { + if (atomic_read(&tbl->entries) >= tbl->max_size * 3 / 2) + return NULL; + en = kmalloc(sizeof(*en), GFP_ATOMIC); if (!en) return NULL; -- 2.53.0