Skip to content

Commit 7eb072b

Browse files
lxinkuba-moo
authored andcommitted
cipso_ipv4: use iph_set_totlen in skbuff_setattr
It may process IPv4 TCP GSO packets in cipso_v4_skbuff_setattr(), so the iph->tot_len update should use iph_set_totlen(). Note that for these non GSO packets, the new iph tot_len with extra iph option len added may become greater than 65535, the old process will cast it and set iph->tot_len to it, which is a bug. In theory, iph options shouldn't be added for these big packets in here, a fix may be needed here in the future. For now this patch is only to set iph->tot_len to 0 when it happens. Signed-off-by: Xin Long <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a13fbf5 commit 7eb072b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/cipso_ipv4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2222,7 +2222,7 @@ int cipso_v4_skbuff_setattr(struct sk_buff *skb,
22222222
memset((char *)(iph + 1) + buf_len, 0, opt_len - buf_len);
22232223
if (len_delta != 0) {
22242224
iph->ihl = 5 + (opt_len >> 2);
2225-
iph->tot_len = htons(skb->len);
2225+
iph_set_totlen(iph, skb->len);
22262226
}
22272227
ip_send_check(iph);
22282228

0 commit comments

Comments
 (0)