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 1DB373E95A9; Tue, 31 Mar 2026 16:50:24 +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=1774975824; cv=none; b=ekY4t5iJGM5p5P2gK5XRKwyv4vO65bxw2gktsuXg4kTjWGlAUFwSWsSH/S7BDJQjgTR/FD97+9/MYUeYINgxxaOg4XUoO5506rmWBsI0P0HnKqu2zEtuPxPozl4vyPyd3Q/t7y7cShBKsPDBhPz9ZVN9XFBymQp8iUY7U0HZM1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774975824; c=relaxed/simple; bh=gwTS92zKpL+ywj1zOdScEreModbxiVjaqeO1YEbrbQs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ve1h1R10bO/PT29p6W+lC3v1NOb5FFI7F3qtHlNCRe/Oe3+H/j1EUqFuP6sKzN6AsbbzIpVhBoG+dHEFQtUBa1tRwYpq8435U85nDA/MG8+G+FPWoaPwch3XPNAaaAIVQT2Rm46DE1bzh5ZMfrVHYyMVcZUnntH34uj6aO/97QA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=PoyEz/Gk; 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="PoyEz/Gk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9D81C19424; Tue, 31 Mar 2026 16:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774975824; bh=gwTS92zKpL+ywj1zOdScEreModbxiVjaqeO1YEbrbQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PoyEz/GkHPUANvA1y7E0PPnA91gUWRsFrWmQSpywVYUcTSEObo3SR1ouCcXuZyTG6 CVEHpkhXolNiGuku0qmuvYoaUTGiRhrVIPemDod8YZtqWuzpnO/uzinvyVtfcJaY1y Hzcw2ydMzGizz6J4DTENI8WGy4fuy1JE2/1kJ4Xc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xiang Mei , Weiming Shi , Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 6.12 099/244] netfilter: nfnetlink_log: fix uninitialized padding leak in NFULA_PAYLOAD Date: Tue, 31 Mar 2026 18:20:49 +0200 Message-ID: <20260331161745.330162785@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260331161741.651718120@linuxfoundation.org> References: <20260331161741.651718120@linuxfoundation.org> User-Agent: quilt/0.69 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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Weiming Shi [ Upstream commit 52025ebaa29f4eb4ed8bf92ce83a68f24ab7fdf7 ] __build_packet_message() manually constructs the NFULA_PAYLOAD netlink attribute using skb_put() and skb_copy_bits(), bypassing the standard nla_reserve()/nla_put() helpers. While nla_total_size(data_len) bytes are allocated (including NLA alignment padding), only data_len bytes of actual packet data are copied. The trailing nla_padlen(data_len) bytes (1-3 when data_len is not 4-byte aligned) are never initialized, leaking stale heap contents to userspace via the NFLOG netlink socket. Replace the manual attribute construction with nla_reserve(), which handles the tailroom check, header setup, and padding zeroing via __nla_reserve(). The subsequent skb_copy_bits() fills in the payload data on top of the properly initialized attribute. Fixes: df6fb868d611 ("[NETFILTER]: nfnetlink: convert to generic netlink attribute functions") Reported-by: Xiang Mei Signed-off-by: Weiming Shi Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nfnetlink_log.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 134e05d31061e..aa5fc9bffef0c 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c @@ -647,15 +647,11 @@ __build_packet_message(struct nfnl_log_net *log, if (data_len) { struct nlattr *nla; - int size = nla_attr_size(data_len); - if (skb_tailroom(inst->skb) < nla_total_size(data_len)) + nla = nla_reserve(inst->skb, NFULA_PAYLOAD, data_len); + if (!nla) goto nla_put_failure; - nla = skb_put(inst->skb, nla_total_size(data_len)); - nla->nla_type = NFULA_PAYLOAD; - nla->nla_len = size; - if (skb_copy_bits(skb, 0, nla_data(nla), data_len)) BUG(); } -- 2.51.0