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 372F72E093A; Mon, 20 Apr 2026 15:51:32 +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=1776700292; cv=none; b=jnzvKSU5neKNprXya8qGdtmt5A2n9C5m+3LoUOzcNzOUIA7Ddb/i9iS0Bg+bI7O9bfCvdaV/7kysnJg1Pyu+RA1pu//5HWR0NRPNL6fq7VgCTGlF/03+rW7JIAt2XTd7Ty4aRMB0gYIPqtzTKop73/bOV5sxTsh0YLktN+7UX+M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776700292; c=relaxed/simple; bh=rGPO+u3SIRrc0WP/EjFkdF1MllnOj3f/ntwv8sEOnoE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GSAgW9THPMp6vHYszdZzq7kloxS90gk/sxu2xymfdpBpL1WuMz8wbQHb+uEGrjhrocNAOOIg//iOSSkXDW+MhXH2jNUgqubs7I7X6yUN+bBQMg8ZilwvPK5Oj8SganiLf9g0wUqJplKoFQb829zIuSVFR3uQ+SZhAnhwBkWreo0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=F3qTux1m; 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="F3qTux1m" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C18E1C19425; Mon, 20 Apr 2026 15:51:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776700292; bh=rGPO+u3SIRrc0WP/EjFkdF1MllnOj3f/ntwv8sEOnoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F3qTux1mO+JiyCtKIy17ITHO4nSBk2MpflfYnW3uSh53TFUkQnCRIgz1BWiMYl7NA 1PB+HPkkI1+ufLL/9vZ5wddTVosDg6KhxUJorG1VcGnEwkgX4H3ao04xZFkuh8HeRd Lu2UwiUsRw++TZfDliwI8lKmUZP+qhq82QkACsHs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Weiming Shi , Xiang Mei , Florian Westphal , Sasha Levin Subject: [PATCH 6.19 116/220] netfilter: nfnetlink_log: initialize nfgenmsg in NLMSG_DONE terminator Date: Mon, 20 Apr 2026 17:40:57 +0200 Message-ID: <20260420153938.205950429@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260420153934.013228280@linuxfoundation.org> References: <20260420153934.013228280@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xiang Mei [ Upstream commit 1f3083aec8836213da441270cdb1ab612dd82cf4 ] When batching multiple NFLOG messages (inst->qlen > 1), __nfulnl_send() appends an NLMSG_DONE terminator with sizeof(struct nfgenmsg) payload via nlmsg_put(), but never initializes the nfgenmsg bytes. The nlmsg_put() helper only zeroes alignment padding after the payload, not the payload itself, so four bytes of stale kernel heap data are leaked to userspace in the NLMSG_DONE message body. Use nfnl_msg_put() to build the NLMSG_DONE terminator, which initializes the nfgenmsg payload via nfnl_fill_hdr(), consistent with how __build_packet_message() already constructs NFULNL_MSG_PACKET headers. Fixes: 29c5d4afba51 ("[NETFILTER]: nfnetlink_log: fix sending of multipart messages") Reported-by: Weiming Shi Signed-off-by: Xiang Mei Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin --- net/netfilter/nfnetlink_log.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index dcd2493a9a404..b1f3eda85989c 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c @@ -361,10 +361,10 @@ static void __nfulnl_send(struct nfulnl_instance *inst) { if (inst->qlen > 1) { - struct nlmsghdr *nlh = nlmsg_put(inst->skb, 0, 0, - NLMSG_DONE, - sizeof(struct nfgenmsg), - 0); + struct nlmsghdr *nlh = nfnl_msg_put(inst->skb, 0, 0, + NLMSG_DONE, 0, + AF_UNSPEC, NFNETLINK_V0, + htons(inst->group_num)); if (WARN_ONCE(!nlh, "bad nlskb size: %u, tailroom %d\n", inst->skb->len, skb_tailroom(inst->skb))) { kfree_skb(inst->skb); -- 2.53.0