diff mbox series

[1/8] xfrm: prevent high SEQ input in non-ESN mode

Message ID 20250324061855.4116819-2-steffen.klassert@secunet.com (mailing list archive)
State Accepted
Commit e3aa43a50a6455831e3c32dabc7ece38d9cd9d05
Delegated to: Netdev Maintainers
Headers show
Series [1/8] xfrm: prevent high SEQ input in non-ESN mode | expand

Checks

Context Check Description
netdev/series_format success Pull request is its own cover letter
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: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 3 maintainers not CCed: edumazet@google.com pabeni@redhat.com horms@kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
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 success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 15 this patch: 15
netdev/checkpatch warning CHECK: Lines should not end with a '('
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
netdev/contest success net-next-2025-03-24--12-00 (tests: 896)

Commit Message

Steffen Klassert March 24, 2025, 6:18 a.m. UTC
From: Leon Romanovsky <leonro@nvidia.com>

In non-ESN mode, the SEQ numbers are limited to 32 bits and seq_hi/oseq_hi
are not used. So make sure that user gets proper error message, in case
such assignment occurred.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/xfrm/xfrm_user.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

patchwork-bot+netdevbpf@kernel.org March 25, 2025, 4:20 p.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (main)
by Steffen Klassert <steffen.klassert@secunet.com>:

On Mon, 24 Mar 2025 07:18:48 +0100 you wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
> 
> In non-ESN mode, the SEQ numbers are limited to 32 bits and seq_hi/oseq_hi
> are not used. So make sure that user gets proper error message, in case
> such assignment occurred.
> 
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
> 
> [...]

Here is the summary with links:
  - [1/8] xfrm: prevent high SEQ input in non-ESN mode
    https://git.kernel.org/netdev/net-next/c/e3aa43a50a64
  - [2/8] xfrm: delay initialization of offload path till its actually requested
    https://git.kernel.org/netdev/net-next/c/585b64f5a620
  - [3/8] xfrm: simplify SA initialization routine
    https://git.kernel.org/netdev/net-next/c/b6ccf61aa4fd
  - [4/8] xfrm: rely on XFRM offload
    https://git.kernel.org/netdev/net-next/c/49431af6c4ef
  - [5/8] xfrm: provide common xdo_dev_offload_ok callback implementation
    https://git.kernel.org/netdev/net-next/c/cc18f482e8b6
  - [6/8] xfrm: check for PMTU in tunnel mode for packet offload
    https://git.kernel.org/netdev/net-next/c/ca70c104e151
  - [7/8] xfrm: state: make xfrm_state_lookup_byaddr lockless
    https://git.kernel.org/netdev/net-next/c/2e460eefbd44
  - [8/8] xfrm: Remove unnecessary NULL check in xfrm_lookup_with_ifid()
    https://git.kernel.org/netdev/net-next/c/399e0aae5aab

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 08c6d6f0179f..5877eabe9d95 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -178,6 +178,12 @@  static inline int verify_replay(struct xfrm_usersa_info *p,
 				       "Replay seq and seq_hi should be 0 for output SA");
 			return -EINVAL;
 		}
+		if (rs->oseq_hi && !(p->flags & XFRM_STATE_ESN)) {
+			NL_SET_ERR_MSG(
+				extack,
+				"Replay oseq_hi should be 0 in non-ESN mode for output SA");
+			return -EINVAL;
+		}
 		if (rs->bmp_len) {
 			NL_SET_ERR_MSG(extack, "Replay bmp_len should 0 for output SA");
 			return -EINVAL;
@@ -190,6 +196,12 @@  static inline int verify_replay(struct xfrm_usersa_info *p,
 				       "Replay oseq and oseq_hi should be 0 for input SA");
 			return -EINVAL;
 		}
+		if (rs->seq_hi && !(p->flags & XFRM_STATE_ESN)) {
+			NL_SET_ERR_MSG(
+				extack,
+				"Replay seq_hi should be 0 in non-ESN mode for input SA");
+			return -EINVAL;
+		}
 	}
 
 	return 0;