[Devel] [PATCH hci-8.2 3/8] ms/net/ipv6: Introduce payload_len helpers
no-reply at sashiko.virtuozzo.com
no-reply at sashiko.virtuozzo.com
Tue Dec 1 04:21:13 MSK 2026
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] sch_cake: cake_ack_filter() passes tail skb to
ipv6_payload_len() for queued skb header
- [Low] ipv6: payload_len helper changes trim behaviour for GSO TCP
skbs, contrary to 'no behavioral change'
--
commit 4ea80ca90ac26540568220de28fd73c759be5f1a
Author: Alice Mikityanska <alice at isovalent.com>
ms/net/ipv6: Introduce payload_len helpers
This adds ipv6_payload_len(), skb_ipv6_payload_len() and ipv6_set_payload_len(). They wrap ip6->payload_len, and fall back to a length computed from skb->len when payload_len is zero. The commit converts the IPv6 paths that can see BIG TCP packets to use them.
Link: https://patch.msgid.link/20260205133925.526371-2-alice.kernel@fastmail.im
> diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
> index a6e2aadbb91bd..d960b887469d0 100644
> --- a/include/linux/ipv6.h
> +++ b/include/linux/ipv6.h
> @@ -125,6 +125,28 @@ static inline unsigned int ipv6_transport_len(const struct sk_buff *skb)
> skb_network_header_len(skb);
> }
>
> +static inline unsigned int
> +ipv6_payload_len(const struct sk_buff *skb, const struct ipv6hdr *ip6)
> +{
> + u32 len = ntohs(ip6->payload_len);
> +
> + return (len || !skb_is_gso(skb) || !skb_is_gso_tcp(skb)) ?
> + len :
> + skb->len - skb_network_offset(skb) - sizeof(struct ipv6hdr);
> +}
> +
[ ... ]
> diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
> index 0b3b81fd4a58a..9c2be98b961ad 100644
> --- a/net/ipv6/ip6_input.c
> +++ b/net/ipv6/ip6_input.c
> @@ -262,7 +262,7 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev,
> skb->transport_header = skb->network_header + sizeof(*hdr);
> IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
>
> - pkt_len = ntohs(hdr->payload_len);
> + pkt_len = ipv6_payload_len(skb, hdr);
>
> /* pkt_len may be zero if Jumbo payload option is present */
> if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) {
[Severity: Low]
Is the "No behavioral change" statement in the commit message accurate?
ipv6_payload_len() falls back to skb->len for any GSO TCP skb with payload_len == 0. It does not require a hop-by-hop jumbo header. Take a GSO TCPv6 skb with payload_len == 0 and nexthdr != NEXTHDR_HOP, for example one injected by a tap or virtio sender. Before the patch, ip6_rcv_core() saw pkt_len == 0 and trimmed the skb to the bare IPv6 header. Now pkt_len is skb->len minus the header, so no trim happens and the skb keeps its full length. br_validate_ipv6() and the other converted callers change in the same way.
Could the commit message describe this change, or could the helper be restricted to the cases the series targets?
[ ... ]
> diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
> index 8db48f8ec81fb..4db9ffb00abd8 100644
> --- a/net/sched/sch_cake.c
> +++ b/net/sched/sch_cake.c
> @@ -1266,7 +1266,7 @@ static struct sk_buff *cake_ack_filter(struct cake_sched_data *q,
> ipv6_addr_cmp(&ipv6h_check->daddr, &ipv6h->daddr))
> continue;
>
> - seglen = ntohs(ipv6h_check->payload_len);
> + seglen = ipv6_payload_len(skb, ipv6h_check);
> } else {
> WARN_ON(1); /* shouldn't happen */
> continue;
[Severity: Low]
Does this read the length from the wrong skb? ipv6h_check is the header of skb_check, but skb is the triggering tail skb.
Take a queued BIG TCP GSO skb with payload_len == 0 when ack-filter is on and split-gso is off. The fallback then uses skb->len and skb_network_offset() of the tail. Suppose the tail is a small pure ACK of the same 5-tuple. Then seglen ends up equal to the tail's TCP header length, so the later (seglen - __tcp_hdrlen(tcph_check)) != 0 test can pass. The queued data skb may then be treated as a pure ACK and dropped, forcing a retransmit. Before the patch, seglen was 0 for such a skb, so it was never eligible.
Should this pass skb_check instead of skb? The IPv4 line next to it, iph_totlen(skb, iph_check), has the same mismatch. This patch did not introduce it.
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply at sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261130184822.2743885-1-eva.kurchatova@virtuozzo.com?part=3
More information about the Devel
mailing list