]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
xfrm: Clear RX SKB secpath xfrm_offload
authorIlan Tayari <ilant@mellanox.com>
Tue, 1 Aug 2017 09:49:09 +0000 (12:49 +0300)
committerSteffen Klassert <steffen.klassert@secunet.com>
Wed, 2 Aug 2017 09:00:15 +0000 (11:00 +0200)
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>
net/xfrm/xfrm_input.c

index 923205e279f72dbab95cee827987feccc690c678..f07eec59dcae1c6f76832374280cd6a0609f0441 100644 (file)
@@ -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;
@@ -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;