Subject: Re: [PATCH net v2] xfrm: iptfs: only publish mode_data after clone setup

From: Simon Horman <[email-masked]>
Date: Fri, 13 Mar 2026 14:26:07 +0000

On Thu, Mar 12, 2026 at 11:39:09AM +0000, Paul Moses wrote:
> iptfs_clone_state() stores x->mode_data before allocating the reorder
> window. If that allocation fails, the code frees the cloned state and
> returns -ENOMEM, leaving x->mode_data pointing at freed memory.
> 
> The xfrm clone unwind later runs destroy_state() through x->mode_data,
> so the failed clone path tears down IPTFS state that clone_state()
> already freed.
> 
> Keep the cloned IPTFS state private until all allocations succeed so
> failed clones leave x->mode_data unset. The destroy path already
> handles a NULL mode_data pointer.
> 
> Fixes: 6be02e3e4f37 ("xfrm: iptfs: handle reordering of received packets")
> Cc: [email-masked]
> Signed-off-by: Paul Moses <[email-masked]>
> ---
> Changes in v2:
> - Fix Fixes tag to point to 6be02e3e4f37

Thanks for the update.

Reviewed-by: Simon Horman <[email-masked]>