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=1796384835; b=iYU2e8I0O3nzuUIlPMnBBwJ1x21MQ3H91QOQHrsJyl6UJk+t6pyKJRF055O02Mb3WIYK TjJVJf2wZR4WnGaP6qeBiEZbE/dIthnhLhumrrcDQD20kdayB+RrRzG2K9x2mNh+FVm6U BudLEyIhbo8KD8whWgX/AexY0FHabLxg3OnAzIzikD3Fzlyz7meKjgNsmVfIszYReKc9E tvnK4J32vYjzdgYBUatc1Lbf7KDMW7BwJT5YFHw9XByGVZuItCfir3wmFIl7P58EKwsV6 NrgrhVYxMmljhlAWgPkVW+zpZASrEqbpnQcJP6DCF2l33DLEDCKSI0wK25ybNROTgUA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384835; 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=/lavBqMRzDqBfamdmn97SIeL9/3tPFFMZnnuEGLFWTc=; b=3p/jwDhrmGzCu7yhwr/A7ZFfF9C05KRl5kYIaHloGJCoa69Mj6NV2UvtgFXm40Ulhv/9 6ZGOu3ws39GJojb6j4pguqaVMgVH1wfpAAYLD2o2T8u6YVYynG1KBmfhGeHqCbFvuZ4XB IAiXrBjyOt/AzAMv7OQB2W2mx0dZ/dCQ3vBF6l68fS+84331Smn+qPWAaGqk+Vp74SwDU 4cSBC987oJQkQgxYRWqyori05GkkADdPlyDjgR1vhsHOqYb2kva+DhrJuKlgbJ33sWtPf nf2dQFeeVX5RCMvg652qYL6ljw+dR0Nd5tCAsPRXvy2M+zQxbz8Bgbiclfz1SKkUEfw== 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=oouzmy2h; 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 D20D2606A322; Fri, 4 Dec 2026 11:47:15 +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=oouzmy2h Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BD331F000C2; Fri, 4 Dec 2026 11:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384835; bh=/lavBqMRzDqBfamdmn97SIeL9/3tPFFMZnnuEGLFWTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oouzmy2hg0Yxf+0tJ4y+VZY/zWSFjlQcDChWI7qlV1xE/3PUw7LuUmMhmjXTDM1Wa KVteILH7lYrolxGz7kBZB2FGUI4LzjMo4DAibXUrAliGQBIq50uFTUaQKide6tr9pD W1MbhmuYfXGx+2SIHhibjTCLyEOTeirXT5jY0Jy8= 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.6 0313/1167] sit: charge ip_tunnel_prl_entry allocations to memcg Date: Fri, 4 Dec 2026 18:55:40 +0900 Message-ID: <20261204100710.170204406@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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.6-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: Kept the older kzalloc(sizeof(...), flags) form instead of upstream's kzalloc_obj() helper, changing only GFP_KERNEL to GFP_KERNEL_ACCOUNT. ] 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