]> git.itanic.dy.fi Git - linux-stable/commitdiff
xfrm: Allow UDP encapsulation only in offload modes
authorLeon Romanovsky <leonro@nvidia.com>
Tue, 12 Mar 2024 11:55:22 +0000 (13:55 +0200)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:17:34 +0000 (18:17 -0400)
[ Upstream commit 773bb766ca4a05bf363203030b72b10088869224 ]

The missing check of x->encap caused to the situation where GSO packets
were created with UDP encapsulation.

As a solution return the encap check for non-offloaded SA.

Fixes: 983a73da1f99 ("xfrm: Pass UDP encapsulation in TX packet offload")
Closes: https://lore.kernel.org/all/a650221ae500f0c7cf496c61c96c1b103dcb6f67.camel@redhat.com
Reported-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/xfrm/xfrm_device.c

index 653e51ae39648da177b84c82881932e9987eaa99..6346690d5c699d4d9f9b46aeeacaa923c0c32256 100644 (file)
@@ -407,7 +407,8 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
        struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
        struct net_device *dev = x->xso.dev;
 
-       if (!x->type_offload)
+       if (!x->type_offload ||
+           (x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED && x->encap))
                return false;
 
        if (x->xso.type == XFRM_DEV_OFFLOAD_PACKET ||