]> git.ipfire.org Git - thirdparty/kernel/linux.git/blobdiff - net/xfrm/xfrm_device.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
[thirdparty/kernel/linux.git] / net / xfrm / xfrm_device.c
index 6346690d5c699d4d9f9b46aeeacaa923c0c32256..2455a76a1cffb4560f7fba34bdd2de03a492fb35 100644 (file)
@@ -253,6 +253,12 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
                return -EINVAL;
        }
 
+       if ((xuo->flags & XFRM_OFFLOAD_INBOUND && x->dir == XFRM_SA_DIR_OUT) ||
+           (!(xuo->flags & XFRM_OFFLOAD_INBOUND) && x->dir == XFRM_SA_DIR_IN)) {
+               NL_SET_ERR_MSG(extack, "Mismatched SA and offload direction");
+               return -EINVAL;
+       }
+
        is_packet_offload = xuo->flags & XFRM_OFFLOAD_PACKET;
 
        /* We don't yet support UDP encapsulation and TFC padding. */