浏览代码

xfrm: Clear RX SKB secpath xfrm_offload

If an incoming packet undergoes XFRM crypto-offload, its secpath is
filled with xfrm_offload struct denoting offload information.

If the SKB is then forwarded to a device which supports crypto-
offload, the stack wrongfully attempts to offload it (even though
the output SA may not exist on the device) due to the leftover
secpath xo.

Clear the ingress xo by zeroizing secpath->olen just before
delivering the decapsulated packet to the network stack.

Fixes: d77e38e612a0 ("xfrm: Add an IPsec hardware offloading API")
Signed-off-by: Ilan Tayari <ilant@mellanox.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Ilan Tayari 8 年之前
父节点
当前提交
7e9e9202bc
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      net/xfrm/xfrm_input.c

+ 2 - 0
net/xfrm/xfrm_input.c

@@ -424,6 +424,7 @@ resume:
 	nf_reset(skb);
 	nf_reset(skb);
 
 
 	if (decaps) {
 	if (decaps) {
+		skb->sp->olen = 0;
 		skb_dst_drop(skb);
 		skb_dst_drop(skb);
 		gro_cells_receive(&gro_cells, skb);
 		gro_cells_receive(&gro_cells, skb);
 		return 0;
 		return 0;
@@ -434,6 +435,7 @@ resume:
 
 
 		err = x->inner_mode->afinfo->transport_finish(skb, xfrm_gro || async);
 		err = x->inner_mode->afinfo->transport_finish(skb, xfrm_gro || async);
 		if (xfrm_gro) {
 		if (xfrm_gro) {
+			skb->sp->olen = 0;
 			skb_dst_drop(skb);
 			skb_dst_drop(skb);
 			gro_cells_receive(&gro_cells, skb);
 			gro_cells_receive(&gro_cells, skb);
 			return err;
 			return err;