[PATCH net] calipso: keep BIG TCP payload_len in calipso_skbuff_setattr()

Wang Zhan wang.zhan at smartx.com
Fri Oct 9 08:46:16 UTC 2026


On Thu, 08 Oct 2026 12:28:24 -0300 Joas Antonio dos Santos wrote:
> @@ -1357,8 +1357,9 @@ static int calipso_skbuff_setattr(struct sk_buff *skb,
>  			sizeof(*ip6_hdr) + start);
>  		skb_reset_network_header(skb);
>  		ip6_hdr = ipv6_hdr(skb);
> -		payload = ntohs(ip6_hdr->payload_len);
> -		ip6_hdr->payload_len = htons(payload + len_delta);
> +		/* BIG TCP packets have payload_len == 0 */
> +		if (ip6_hdr->payload_len)
> +			be16_add_cpu(&ip6_hdr->payload_len, len_delta);

Hi,

I think there are boundary cases around IPV6_MAXPLEN: growing past it
can cause payload_len to overflow, while shrinking below it leaves
payload_len at zero.

Could we use ipv6_set_payload_len(ip6_hdr, skb->len - sizeof(*ip6_hdr))
to set the length here? I haven't checked the details, though.



More information about the Linux-security-module-archive mailing list