From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 6F5422E7379; Sat, 30 May 2026 17:38:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780162715; cv=none; b=OKoADOFa58iFug3xWRIqA+JhN+/sgLf3DiMZsitgbtapIVpULMsmL6i5vlDTN6H2zHjH4JBoQBf5/XLAPfv0sDM+oV3t1u5wIkzlnoILETJYLm3r/4BSkSfN2Bg+xaaerskqftFvWvpCDdJ/CfGS3VQZFeIg8fL2h9oX8bPittQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780162715; c=relaxed/simple; bh=vtie2bKHPHhY2/yR4Bo2g5R8NEJizzRFt+xLyzieNCw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LSQ4rBSSEqdhRSZaTpIp/ggJPdXQjBikK9txKZwgoeLmZZJZi3fTJ9wQ5Gt3q1BXoyg2B2tZyOFGWBj/RWbpPUm35yjFa4sVsk7GrByh0s5HZC31jTZyKk9ty9VvsjGJqszzJZKvWNn2fCmig5sX+J4dlPpRBWB6tE61hVMS+VI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=L/IyAvrz; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="L/IyAvrz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6FFC1F00893; Sat, 30 May 2026 17:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780162714; bh=o629ZnRffokwAYxPg6+WYVTRY+pu9gtCvrPqQf6G/Q8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=L/IyAvrzwVx7sw8QA0J+KNkTppmRT1yNdCQdCJj/QehrJ4S16uf2+5sdo5z3XtPyH gfiJzxF2BjKOVfX0W1825rh2vUuDzLyKDXYJEGseNrqzXS6FmkjebPXfjoV2NJCuyv C7T/9RxfzCNonsLNbr7V0DzeVwJBSqCGJjZW7YZs= 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 5.15 034/776] netfilter: nfnetlink_log: initialize nfgenmsg in NLMSG_DONE terminator Date: Sat, 30 May 2026 17:55:48 +0200 Message-ID: <20260530160241.161551464@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160240.228940103@linuxfoundation.org> References: <20260530160240.228940103@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 5.15-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 37d10c3d19b60..db309c4167427 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c @@ -350,10 +350,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