]> git.baikalelectronics.ru Git - kernel.git/commit
xfrm: Fix double ESP trailer insertion in IPsec crypto offload.
authorHuy Nguyen <huyn@mellanox.com>
Mon, 1 Jun 2020 21:39:37 +0000 (16:39 -0500)
committerSteffen Klassert <steffen.klassert@secunet.com>
Thu, 4 Jun 2020 08:45:14 +0000 (10:45 +0200)
commit75d6d66a7554e0b0d3dfe3c42b3dac629662e359
tree993e23a70e70df318f25b6b7d8e80509e623fa21
parent6ce89b8efb8e42eeb3d22257131c6c58d56b158a
xfrm: Fix double ESP trailer insertion in IPsec crypto offload.

During IPsec performance testing, we see bad ICMP checksum. The error packet
has duplicated ESP trailer due to double validate_xmit_xfrm calls. The first call
is from ip_output, but the packet cannot be sent because
netif_xmit_frozen_or_stopped is true and the packet gets dev_requeue_skb. The second
call is from NET_TX softirq. However after the first call, the packet already
has the ESP trailer.

Fix by marking the skb with XFRM_XMIT bit after the packet is handled by
validate_xmit_xfrm to avoid duplicate ESP trailer insertion.

Fixes: 7d3452498670 ("net: Add a xfrm validate function to validate_xmit_skb")
Signed-off-by: Huy Nguyen <huyn@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Reviewed-by: Raed Salem <raeds@mellanox.com>
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
include/net/xfrm.h
net/xfrm/xfrm_device.c