netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, fw@strlen.de,
	horms@kernel.org
Subject: [PATCH net-next 17/19] netfilter: xt_nfacct: don't assume acct name is null-terminated
Date: Fri, 25 Jul 2025 19:03:38 +0200	[thread overview]
Message-ID: <20250725170340.21327-18-pablo@netfilter.org> (raw)
In-Reply-To: <20250725170340.21327-1-pablo@netfilter.org>

From: Florian Westphal <fw@strlen.de>

BUG: KASAN: slab-out-of-bounds in .. lib/vsprintf.c:721
Read of size 1 at addr ffff88801eac95c8 by task syz-executor183/5851
[..]
 string+0x231/0x2b0 lib/vsprintf.c:721
 vsnprintf+0x739/0xf00 lib/vsprintf.c:2874
 [..]
 nfacct_mt_checkentry+0xd2/0xe0 net/netfilter/xt_nfacct.c:41
 xt_check_match+0x3d1/0xab0 net/netfilter/x_tables.c:523

nfnl_acct_find_get() handles non-null input, but the error
printk relied on its presence.

Reported-by: syzbot+4ff165b9251e4d295690@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=4ff165b9251e4d295690
Tested-by: syzbot+4ff165b9251e4d295690@syzkaller.appspotmail.com
Fixes: ceb98d03eac5 ("netfilter: xtables: add nfacct match to support extended accounting")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/xt_nfacct.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/xt_nfacct.c b/net/netfilter/xt_nfacct.c
index 7c6bf1c16813..0ca1cdfc4095 100644
--- a/net/netfilter/xt_nfacct.c
+++ b/net/netfilter/xt_nfacct.c
@@ -38,8 +38,8 @@ nfacct_mt_checkentry(const struct xt_mtchk_param *par)
 
 	nfacct = nfnl_acct_find_get(par->net, info->name);
 	if (nfacct == NULL) {
-		pr_info_ratelimited("accounting object `%s' does not exists\n",
-				    info->name);
+		pr_info_ratelimited("accounting object `%.*s' does not exist\n",
+				    NFACCT_NAME_MAX, info->name);
 		return -ENOENT;
 	}
 	info->nfacct = nfacct;
-- 
2.30.2


  parent reply	other threads:[~2025-07-25 17:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25 17:03 [PATCH net-next 00/19] Netfilter/IPVS updates for net-next Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 01/19] netfilter: conntrack: table full detailed log Pablo Neira Ayuso
2025-07-25 23:50   ` patchwork-bot+netdevbpf
2025-07-25 17:03 ` [PATCH net-next 02/19] netfilter: load nf_log_syslog on enabling nf_conntrack_log_invalid Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 03/19] netfilter: x_tables: Remove unused functions xt_{in|out}name() Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 04/19] netfilter: nf_tables: Remove unused nft_reduce_is_readonly() Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 05/19] netfilter: conntrack: Remove unused net in nf_conntrack_double_lock() Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 06/19] netfilter: Exclude LEGACY TABLES on PREEMPT_RT Pablo Neira Ayuso
2025-08-05 15:43   ` Ryan Roberts
2025-08-07 11:46     ` Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 07/19] selftests: net: Enable legacy netfilter legacy options Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 08/19] selftests: netfilter: Enable CONFIG_INET_SCTP_DIAG Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 09/19] ipvs: Rename del_timer in comment in ip_vs_conn_expire_now() Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 10/19] netfilter: nfnetlink: New NFNLA_HOOK_INFO_DESC helper Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 11/19] netfilter: nfnetlink_hook: Dump flowtable info Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 12/19] netfilter: nft_set_pipapo: remove unused arguments Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 13/19] netfilter: nft_set: remove one argument from lookup and update functions Pablo Neira Ayuso
2025-07-25 23:37   ` Jakub Kicinski
2025-07-25 23:45     ` Jakub Kicinski
2025-07-25 17:03 ` [PATCH net-next 14/19] netfilter: nft_set: remove indirection from update API call Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 15/19] netfilter: nft_set_pipapo: merge pipapo_get/lookup Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 16/19] netfilter: nft_set_pipapo: prefer kvmalloc for scratch maps Pablo Neira Ayuso
2025-07-25 17:03 ` Pablo Neira Ayuso [this message]
2025-07-25 17:03 ` [PATCH net-next 18/19] selftests: netfilter: Ignore tainted kernels in interface stress test Pablo Neira Ayuso
2025-07-25 17:03 ` [PATCH net-next 19/19] selftests: netfilter: ipvs.sh: Explicity disable rp_filter on interface tunl0 Pablo Neira Ayuso

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=20250725170340.21327-18-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).