Patch "net/mlx5e: Ensure that IPsec sequence packet number starts from 1" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net/mlx5e: Ensure that IPsec sequence packet number starts from 1

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-mlx5e-ensure-that-ipsec-sequence-packet-number-s.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit be504b9847c84e1e28fddeda96043f5831198060
Author: Leon Romanovsky <leonro@xxxxxxxxxx>
Date:   Wed Sep 20 10:07:13 2023 +0300

    net/mlx5e: Ensure that IPsec sequence packet number starts from 1
    
    [ Upstream commit 3d42c8cc67a8fcbff0181f9ed6d03d353edcee07 ]
    
    According to RFC4303, section "3.3.3. Sequence Number Generation",
    the first packet sent using a given SA will contain a sequence
    number of 1.
    
    However if user didn't set seq/oseq, the HW used zero as first sequence
    packet number. Such misconfiguration causes to drop of first packet
    if replay window protection was enabled in SA.
    
    To fix it, set sequence number to be at least 1.
    
    Fixes: 7db21ef4566e ("net/mlx5e: Set IPsec replay sequence numbers")
    Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
index 65678e89aea62..0d4b8aef6adda 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
@@ -121,7 +121,14 @@ static bool mlx5e_ipsec_update_esn_state(struct mlx5e_ipsec_sa_entry *sa_entry)
 	if (x->xso.type == XFRM_DEV_OFFLOAD_CRYPTO)
 		esn_msb = xfrm_replay_seqhi(x, htonl(seq_bottom));
 
-	sa_entry->esn_state.esn = esn;
+	if (sa_entry->esn_state.esn_msb)
+		sa_entry->esn_state.esn = esn;
+	else
+		/* According to RFC4303, section "3.3.3. Sequence Number Generation",
+		 * the first packet sent using a given SA will contain a sequence
+		 * number of 1.
+		 */
+		sa_entry->esn_state.esn = max_t(u32, esn, 1);
 	sa_entry->esn_state.esn_msb = esn_msb;
 
 	if (unlikely(overlap && seq_bottom < MLX5E_IPSEC_ESN_SCOPE_MID)) {




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux