Skip to content

Commit

Permalink
xfrm: Clear RX SKB secpath xfrm_offload
Browse files Browse the repository at this point in the history
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: d77e38e ("xfrm: Add an IPsec hardware offloading API")
Signed-off-by: Ilan Tayari <[email protected]>
Signed-off-by: Steffen Klassert <[email protected]>
  • Loading branch information
ilantayari authored and klassert committed Aug 2, 2017
1 parent ffdb521 commit 7e9e920
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/xfrm/xfrm_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
nf_reset(skb);

if (decaps) {
skb->sp->olen = 0;
skb_dst_drop(skb);
gro_cells_receive(&gro_cells, skb);
return 0;
Expand All @@ -434,6 +435,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)

err = x->inner_mode->afinfo->transport_finish(skb, xfrm_gro || async);
if (xfrm_gro) {
skb->sp->olen = 0;
skb_dst_drop(skb);
gro_cells_receive(&gro_cells, skb);
return err;
Expand Down

0 comments on commit 7e9e920

Please sign in to comment.