netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH xfrm] xfrm: Allow UDP encapsulation only in offload modes
@ 2024-03-12 11:55 Leon Romanovsky
  2024-03-12 12:24 ` Paolo Abeni
  2024-03-19  7:08 ` Steffen Klassert
  0 siblings, 2 replies; 7+ messages in thread
From: Leon Romanovsky @ 2024-03-12 11:55 UTC (permalink / raw)
  To: Steffen Klassert
  Cc: Leon Romanovsky, David S. Miller, Eric Dumazet, Herbert Xu,
	Jakub Kicinski, netdev, Paolo Abeni

From: Leon Romanovsky <leonro@nvidia.com>

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: 9f2b55961a80 ("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>
---
 net/xfrm/xfrm_device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 ||
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-03-19 10:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-12 11:55 [PATCH xfrm] xfrm: Allow UDP encapsulation only in offload modes Leon Romanovsky
2024-03-12 12:24 ` Paolo Abeni
2024-03-13 10:08   ` Steffen Klassert
2024-03-13 10:32     ` Leon Romanovsky
2024-03-19  7:08 ` Steffen Klassert
2024-03-19 10:27   ` Paolo Abeni
2024-03-19 10:58     ` Steffen Klassert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).