summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@nvidia.com>2024-03-12 13:55:22 +0200
committerSasha Levin <sashal@kernel.org>2024-03-26 18:18:56 -0400
commit44d5790232822f6dd56e29e0e4dc376830ae1f1a (patch)
tree728970873acd4aba449e2f72bf537135a2db8c17
parentee413f30ec4fe94a0bdf32c8f042cb06fa913234 (diff)
downloadlinux-stable-44d5790232822f6dd56e29e0e4dc376830ae1f1a.tar.gz
linux-stable-44d5790232822f6dd56e29e0e4dc376830ae1f1a.tar.bz2
linux-stable-44d5790232822f6dd56e29e0e4dc376830ae1f1a.zip
xfrm: Allow UDP encapsulation only in offload modes
[ 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>
-rw-r--r--net/xfrm/xfrm_device.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
index 653e51ae3964..6346690d5c69 100644
--- a/net/xfrm/xfrm_device.c
+++ b/net/xfrm/xfrm_device.c
@@ -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 ||