From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 821B72FD1A4; Tue, 12 Aug 2025 18:44:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755024245; cv=none; b=Ch/JcIeWZJpesAJFE9qB5K6IHi/4byFSrT/K7myfYGSBau7xMAi5o5OEJhwXyw0WUR57xsBAMYnmpPvETNHK41yKfRkgYEKBDkM9rDgn/mzgkWo3T1szGxZ3wXNYzp3OoK5AYSZB6VAzqmwLN5WyrzHBbM7XspXKB5DqwKaGnNo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755024245; c=relaxed/simple; bh=qMZaYGrNeVlBp7vuAx3fyC19oBhg8gw62eFUzNYwZcI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E5C3XBeGzIed51eZ5O1IEOzW8FBSKCdgJGOH8ju0Q9vAvS0f0FpSIggQPy4oZNY5/KG66qY40Gb9Es4AaiKVR2BJ6m0/22O8Q/99lNneWFf3aTE+Ck5Xu78lCfwBn7PoPk9NUvo5KVpcu+MYCr+UAZsHe2rYIZkmyLFNfOHeQA0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=R3xh/mGZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="R3xh/mGZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3694C4CEF0; Tue, 12 Aug 2025 18:44:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755024245; bh=qMZaYGrNeVlBp7vuAx3fyC19oBhg8gw62eFUzNYwZcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R3xh/mGZGTxOKou0El2QvIWIVWuTiC1AW5Hz9i2ZOKyrctCERpyz9DIMIgLrOfFlN SCQnjyPoqBTOLbiKmh11e9wKciwrGTtPoecE3hUBv2tGd8j++JljlP7Z0Tljt/syem G73O3M0+aJz6BrHB6PoXd1dghCL56yJqcpBNC5ns= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+4ff165b9251e4d295690@syzkaller.appspotmail.com, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 6.16 273/627] netfilter: xt_nfacct: dont assume acct name is null-terminated Date: Tue, 12 Aug 2025 19:29:28 +0200 Message-ID: <20250812173429.700489819@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250812173419.303046420@linuxfoundation.org> References: <20250812173419.303046420@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal [ Upstream commit bf58e667af7d96c8eb9411f926a0a0955f41ce21 ] 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 Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- 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.39.5