cipso_ipv4: use iph_set_totlen in skbuff_setattr
authorXin Long <lucien.xin@gmail.com>
Sat, 28 Jan 2023 15:58:35 +0000 (10:58 -0500)
committerJakub Kicinski <kuba@kernel.org>
Thu, 2 Feb 2023 04:54:27 +0000 (20:54 -0800)
commit7eb072be41ba4d8ecea17092dece50c7375d8980
tree50f8e38a980db70ccba3f9c33a2a6f083f347cee
parenta13fbf5ed5b4fc9095f12e955ca3a59b5507ff01
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 <lucien.xin@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/cipso_ipv4.c