Re: [PATCH] xfrm: iptfs: bound the reassembly copy by the buffer it copies into
From: Andrii Tereshchenko
Date: Fri Nov 20 2026 - 04:06:55 EST
On Thu, 19 Nov 2026 19:53:08 +0530, Piyus Kedia wrote:
> Bound both copies by the tailroom actually available and abandon the
> reassembly otherwise, which is how the function already handles a stream it
> cannot complete.
The inner packet that reaches this check can be valid: its first piece
arrives in an outer packet whose data is shared as page frags, and a
later piece in one that has to be copied. After skb_linearize() the
tailroom is only the slack of that reallocation, so the check drops the
packet whenever the piece is larger than the slack.
On ipsec master with this patch, a test that sends a 1200-byte inner
packet that way, 450 bytes and then 750, and a 100-byte packet after
it, shows no panic, but only the 100-byte packet is delivered. The
other is counted in XfrmInBufferError.
I had a fix for the same overrun and have posted it now, with
Reported-by and Closes for your mail:
https://lore.kernel.org/all/70d0cc8d-e2ff-4293-a416-eaf2705a0b9c@xxxxxxxxxxxxxx/
It makes room with pskb_expand_head() before linearizing, for the frag
data and for the rest of the inner packet, and abandons only when that
allocation fails. The same test gets both packets.