Linux Netfilter development
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nf-next 2/3] netfilter: ebtables: account compat ebt_table_info to kmemcg
Date: Sat,  4 Jul 2026 10:48:10 +0200	[thread overview]
Message-ID: <20260704084811.27355-3-fw@strlen.de> (raw)
In-Reply-To: <20260704084811.27355-1-fw@strlen.de>

sashiko says:
 does compat_do_replace() bypass memory cgroup accounting?

This code is on the chopping block, but lets fix this up
for -stable sake.

Fixes: e2c8d550a973 ("netfilter: ebtables: account ebt_table_info to kmemcg")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/bridge/netfilter/ebtables.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 66c407cffa16..7238e48d51a1 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -2299,7 +2299,7 @@ static int compat_do_replace(struct net *net, sockptr_t arg, unsigned int len)
 	}
 
 	countersize = COUNTER_OFFSET(tmp.nentries) * nr_cpu_ids;
-	newinfo = vmalloc(sizeof(*newinfo) + countersize);
+	newinfo = __vmalloc(sizeof(*newinfo) + countersize, GFP_KERNEL_ACCOUNT);
 	if (!newinfo)
 		return -ENOMEM;
 
@@ -2308,7 +2308,7 @@ static int compat_do_replace(struct net *net, sockptr_t arg, unsigned int len)
 
 	memset(&state, 0, sizeof(state));
 
-	newinfo->entries = vmalloc(tmp.entries_size);
+	newinfo->entries = __vmalloc(tmp.entries_size, GFP_KERNEL_ACCOUNT);
 	if (!newinfo->entries) {
 		ret = -ENOMEM;
 		goto free_newinfo;
-- 
2.55.0


  parent reply	other threads:[~2026-07-04  8:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-04  8:48 [PATCH nf-next 0/3] netfilter: ebtables: shashiko nitpicks Florian Westphal
2026-07-04  8:48 ` [PATCH nf-next 1/3] netfilter: ebtables: zero chainstack array Florian Westphal
2026-07-04  8:48 ` Florian Westphal [this message]
2026-07-04  8:48 ` [PATCH nf-next 3/3] netfilter: ebtables: bound num_counters in do_update_counters() Florian Westphal
2026-07-04  9:31 ` [PATCH nf-next 0/3] netfilter: ebtables: shashiko nitpicks Florian Westphal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260704084811.27355-3-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox