xfrm: esp: restore combined single-frag length gate
Subsystems (2)
Hi, Sabrina.
Thanks for the review.
I have sent the v2 patch with below link:
https://lore.kernel.org/netdev/[email protected]/T/#u
Quoted 2 lines
note: patches to xfrm should go through the "ipsec" tree, not "net" (with the subject prefix [PATCH ipsec]).
Thanks also for pointing out that, I have sent v2 with correct prefix.
Quoted 3 lines
If I'm following correctly, the issue comes from the
skb_len_add(tailen)? Soesp_output_tail()doesskb_page_frag_refill()with [what we checked inesp_output_head()+ tailen]?
Yes, your understanding is correct. esp_output_head() appends tailen to the skb before esp_output_tail() reaches the out-of-place allocation path. In IPv4 this happens through skb_len_add(skb, tailen), and in IPv6 through the explicit skb->len / skb->data_len / skb->truesize updates. After that, esp_output_tail() computes:
allocsize = ALIGN(skb->data_len, L1_CACHE_BYTES);
and uses that size for skb_page_frag_refill(). So the page-frag fast path needs to validate the combined post-trailer data length, not skb->data_len and tailen independently.
Quoted 2 lines
nit: there's already an allocsize variable in this function. no shadowing please.
You are right. The new allocsize variable in v1 shadows the existing variable. In v2 I wrote the combined-length check directly, avoiding the shadowed variable.
Thanks