From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387488; b=WhrB06tBrLCldVdAy2Lb6Ib/nrFjxFrljQ3Y9t/5G5Vvb8RSSx4EnfcRxq8hKAY9EHiz qmVo0LCqcCGbbO5pOU8Ty52yeHFS4OzXiVY8TqGyaWOs/bfy7Ileph84ke8Y8KyaghN9Z /XUjVNiTi8aWTFMPMn/NKWj9fXH5nY335L0WLMlajAiwHpFUCCbkSwPZWETP+35Wn++8C Vp+Zi8OGKCi1tl12DKtHEJd2HZJeo5Jk3mvtc46FVQqYEQd+TvqgsAZTnBqRTr40/o5gr 7pl0VXxYVaOaZLvXu4Ry8TJw3FrGD0Zp5l19//QuaGrvl/x7Xxh3rHPi+6ThPfPtsfw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387488; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=EpcAuBWw5GELjWHl72Lr1uzNsSP0r5SVN7Mz7jFcM0A=; b=B8OzGTdFKNjYjboa99SOwbq/Unwi8lD9c2nK+Syd/ZegrOrRYuZA8XnrXDfcK842PKtC XEiE/7CDAaaL0bL0DBiSAs8otS7VB0jHJ3FNTtLZfYpI3C7/r9HuNxlF9V2ilZR/82VsN RUnDmflyr8mhNFebXtIkZNLdGUES6wOhrvMZsp11M8gniF8vCfsOpC7/yCzlyFq/UceXm 5f3Zx7sfXjIuFNaDggtDq9D2HwetjABXTpPuCf9QYsJ75QlWx2ylgA3lPhv0taUZmxwPo 3yv3+VfEQijBoLbgMxsKWIxG53fAE2i4lyswH18tb4JldATdY3eeoH/uH92BsFsQBHQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Wn1150ee; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 419B2606A322; Fri, 4 Dec 2026 12:31:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Wn1150ee Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0EF81F000C2; Fri, 4 Dec 2026 12:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387488; bh=EpcAuBWw5GELjWHl72Lr1uzNsSP0r5SVN7Mz7jFcM0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Wn1150eerDnsOBwLUwK9tCjarshxYY5KGi6HWdPFU73G2HuyrBteiko39GKwK7Soi HgrR8ExwSG8/yVVHGVamLTSPo1ocVS4/38FleVbvAG7qr7VbOEaSbEZb7Z8soliLhw 7W+GU5HpeK5KTg5gn9NlexL3NTXo+ln36MY97J0c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Lorenzo Bianconi , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 0264/1059] sit: charge ip_tunnel_prl_entry allocations to memcg Date: Fri, 4 Dec 2026 18:56:35 +0900 Message-ID: <20261204100651.109763367@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit 40a2b90f5190fcc7b083809fa93f2799abefeeb1 ] ipip6_tunnel_add_prl() allocates struct ip_tunnel_prl_entry for each potential router entry added via SIOCADDPRL. An unprivileged user with CAP_NET_ADMIN in a user namespace can add an unbounded number of entries, consuming uncharged kernel memory. Commit 1b51d8271973 ("memcg: ipv6/sit: account and don't WARN on ip_tunnel_prl structs allocation") added accounting to the temporary buffer in ipip6_tunnel_get_prl(), but missed the entry allocations in ipip6_tunnel_add_prl(). Use GFP_KERNEL_ACCOUNT when allocating struct ip_tunnel_prl_entry. Fixes: 1b51d8271973 ("memcg: ipv6/sit: account and don't WARN on ip_tunnel_prl structs allocation") Signed-off-by: Eric Dumazet Acked-by: Lorenzo Bianconi Link: https://patch.msgid.link/20260907075846.2913645-3-edumazet@google.com Signed-off-by: Jakub Kicinski [ sashal: Changed kzalloc_obj(struct ip_tunnel_prl_entry, GFP_KERNEL_ACCOUNT) to the older kzalloc(sizeof(struct ip_tunnel_prl_entry), GFP_KERNEL_ACCOUNT), since kzalloc_obj() helpers don't exist here. ] Signed-off-by: Sasha Levin --- net/ipv6/sit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 2c0d62ec8ec4f..f83b6488ded4c 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -391,7 +391,7 @@ ipip6_tunnel_add_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a, int chg) goto out; } - p = kzalloc(sizeof(struct ip_tunnel_prl_entry), GFP_KERNEL); + p = kzalloc(sizeof(struct ip_tunnel_prl_entry), GFP_KERNEL_ACCOUNT); if (!p) { err = -ENOBUFS; goto out; -- 2.53.0