Re: [PATCH ipsec v2] xfrm: zero-initialise km_event in the replay-notify path

From: Steffen Klassert

Date: Wed Oct 14 2026 - 03:38:35 EST


On Wed, Oct 07, 2026 at 01:28:07PM +0530, Shubham Antil wrote:
> 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 <gio@octane.security>
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Shubham Antil <shubham@octane.security>

Patch applied, thanks a lot!