From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379609; b=N7JsusFEDGnJGvbGYXFHmwZlbT7sRhZtS7qZMjF7Y8fUtPWXInZGiS+zTGU9F3mgsPja Jq19nFePp4O9paF1HKKmCl52dCiew17EHhXtdqytaEArlmfiO446SLo/zlzabu5Teyti2 q12u3ZA9SF8VtIerHI88gNd8jn1RaFhObOsJV8hBV3LfaxmXUNw6u6cfsc3PA3HxCJNbd pwRqzPMrp2Bzv9mxPcyDHDMmdnyZ+ZhMm5IbSN4StuijgL75yu3kWF7UjuQ9NcOrP8I00 NWTN55Xv/951VTCbgP8Eg2K5VsuZk2EFQqUdTexzjihuMwhF64UjzPF99G9Gi5aQ+kQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379609; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=EmHMHRFowv8Zxu1oD/JwJDZG3P7S76NlnAvTv/ylWRs=; b=aVRlHUVXgf6arKXwo6LpfgyZUQ6QayQwDf+HhVTgbkJ9MmWd2IudQBfP1rWiz8ycVbLL EOe0GqVNRQEVk+2hDnKFykj+Fgz2PUz9IQq3ZgRjb+seBf+EVBPRXgjo28PqAMB9rrb/6 wwUDn9EUPPHAhpyBKLJSW6qm3JR8+bGpsAlSA6dT1qOshmh/FD/slkx3vqqP9cFeQqeXV L7ZA98wsndOTUfhSF2O3dtGNREvyrpQYMsf6kL0YBXuVnQ6bxh3m5trGAeqhXpDl16NCD PJGWv4uRCNL8Z+xyH//55MnEgW+HKDu4K3SnXRQH9lH/opk224TGBx1/OU1m0Qw8HRw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=zwC7WiDb; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA7BF606A322; Fri, 4 Dec 2026 10:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=zwC7WiDb Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64EA01F00897; Fri, 4 Dec 2026 10:20:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379608; bh=EmHMHRFowv8Zxu1oD/JwJDZG3P7S76NlnAvTv/ylWRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zwC7WiDbsrdbrTW9cD3LY9Owk5RT8WYjB88LmMt0Qq301UH0CEdEO0YelQ2oqte4R u5NWhOLqKMWxHODS665tUVjJd+gwpN9oh3g/rsm/Sw40UgIdCIp8woPfpZMjfYKLYE p6iUo/ZMNz8YD+rTsqFQp4ryxjcY9K3/5xbsOx00= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Giovanni Vignone , Shubham Antil , Steffen Klassert , Sasha Levin Subject: [PATCH 6.1 0027/1059] xfrm: zero-initialise km_event in the replay-notify path Date: Fri, 4 Dec 2026 18:52:38 +0900 Message-ID: <20261204100644.739755397@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shubham Antil [ Upstream commit e35a12dffd5da67b6ca12bd23eebdd0570592205 ] xfrm_replay_notify(), xfrm_replay_notify_bmp() and xfrm_replay_notify_esn() declare a struct km_event on the stack and initialise only its .event and .data.aevent fields, leaving .seq and .portid uninitialised. build_aevent() then builds the XFRM_MSG_NEWAE message with those fields: nlmsg_put(skb, c->portid, c->seq, ...) so the netlink header of a replay event carries uninitialised stack values rather than defined ones. This was confirmed at runtime rather than by inspection alone: the .seq and .portid carried in that header hold values that nothing in the replay path assigns. The request-driven paths set these header fields from the requester (xfrm_get_ae() / xfrm_new_ae()); only the kernel-originated replay path leaves them unset. Zero-initialise the event so the header fields are 0, the correct value for a kernel-originated notification. Fixes: f8cd54884e67 ("[IPSEC]: Sync series - core changes") Reported-by: Giovanni Vignone Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Shubham Antil Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/xfrm/xfrm_replay.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c index 7f52bb2e14c13..ad54fe0b89ada 100644 --- a/net/xfrm/xfrm_replay.c +++ b/net/xfrm/xfrm_replay.c @@ -40,7 +40,7 @@ static void xfrm_replay_notify_esn(struct xfrm_state *x, int event); void xfrm_replay_notify(struct xfrm_state *x, int event) { - struct km_event c; + struct km_event c = {}; /* we send notify messages in case * 1. we updated on of the sequence numbers, and the seqno difference * is at least x->replay_maxdiff, in this case we also update the @@ -304,7 +304,7 @@ static void xfrm_replay_advance_bmp(struct xfrm_state *x, __be32 net_seq) static void xfrm_replay_notify_bmp(struct xfrm_state *x, int event) { - struct km_event c; + struct km_event c = {}; struct xfrm_replay_state_esn *replay_esn = x->replay_esn; struct xfrm_replay_state_esn *preplay_esn = x->preplay_esn; @@ -356,7 +356,7 @@ static void xfrm_replay_notify_bmp(struct xfrm_state *x, int event) static void xfrm_replay_notify_esn(struct xfrm_state *x, int event) { u32 seq_diff, oseq_diff; - struct km_event c; + struct km_event c = {}; struct xfrm_replay_state_esn *replay_esn = x->replay_esn; struct xfrm_replay_state_esn *preplay_esn = x->preplay_esn; -- 2.53.0