diff mbox series

[xfrm] xfrm: Allow UDP encapsulation only in offload modes

Message ID 3d3a34ffce4f66b8242791d1e6b3091aec8a2c25.1710244420.git.leonro@nvidia.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [xfrm] xfrm: Allow UDP encapsulation only in offload modes | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 942 this patch: 942
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 957 this patch: 957
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes fail Problems with Fixes tag: 1
netdev/build_allmodconfig_warn success Errors and warnings before: 958 this patch: 958
netdev/checkpatch warning WARNING: Unknown commit id '9f2b55961a80', maybe rebased or not pulled?
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Leon Romanovsky March 12, 2024, 11:55 a.m. UTC
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(-)

Comments

Paolo Abeni March 12, 2024, 12:24 p.m. UTC | #1
On Tue, 2024-03-12 at 13:55 +0200, Leon Romanovsky wrote:
> 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")

Should be:

Fixes: 983a73da1f99 ("xfrm: Pass UDP encapsulation in TX packet offload")

@Steffen: I guess you want to apply it first in your tree and send it later as PR?
In such case, could you please adjust the fixes hash while at it?

Thanks!

Paolo
Steffen Klassert March 13, 2024, 10:08 a.m. UTC | #2
On Tue, Mar 12, 2024 at 01:24:31PM +0100, Paolo Abeni wrote:
> On Tue, 2024-03-12 at 13:55 +0200, Leon Romanovsky wrote:
> > 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")
> 
> Should be:
> 
> Fixes: 983a73da1f99 ("xfrm: Pass UDP encapsulation in TX packet offload")
> 
> @Steffen: I guess you want to apply it first in your tree and send it later as PR?
> In such case, could you please adjust the fixes hash while at it?

Yes, I'll adjust the fixes tag.

Thanks!
Leon Romanovsky March 13, 2024, 10:32 a.m. UTC | #3
On Wed, Mar 13, 2024 at 11:08:51AM +0100, Steffen Klassert wrote:
> On Tue, Mar 12, 2024 at 01:24:31PM +0100, Paolo Abeni wrote:
> > On Tue, 2024-03-12 at 13:55 +0200, Leon Romanovsky wrote:
> > > 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")
> > 
> > Should be:
> > 
> > Fixes: 983a73da1f99 ("xfrm: Pass UDP encapsulation in TX packet offload")
> > 
> > @Steffen: I guess you want to apply it first in your tree and send it later as PR?
> > In such case, could you please adjust the fixes hash while at it?
> 
> Yes, I'll adjust the fixes tag.
> 

Thanks
Steffen Klassert March 19, 2024, 7:08 a.m. UTC | #4
On Tue, Mar 12, 2024 at 01:55:22PM +0200, Leon Romanovsky wrote:
> 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>

Applied, thanks Leon!
Paolo Abeni March 19, 2024, 10:27 a.m. UTC | #5
On Tue, 2024-03-19 at 08:08 +0100, Steffen Klassert wrote:
> On Tue, Mar 12, 2024 at 01:55:22PM +0200, Leon Romanovsky wrote:
> > 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>
> 
> Applied, thanks Leon!

Steffen, as the issue addressed here is causing self-test failures in
our CI, could you please send the PR including this change somewhat
soonish? 

Many thanks,

Paolo
Steffen Klassert March 19, 2024, 10:58 a.m. UTC | #6
On Tue, Mar 19, 2024 at 11:27:43AM +0100, Paolo Abeni wrote:
> On Tue, 2024-03-19 at 08:08 +0100, Steffen Klassert wrote:
> > On Tue, Mar 12, 2024 at 01:55:22PM +0200, Leon Romanovsky wrote:
> > > 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>
> > 
> > Applied, thanks Leon!
> 
> Steffen, as the issue addressed here is causing self-test failures in
> our CI, could you please send the PR including this change somewhat
> soonish? 

No problem, will come during the next hour.
diff mbox series

Patch

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