[PATCH 10/13] crypto/cnxk: acquire lock while updating antireplay
Tejasree Kondoj
ktejasree at marvell.com
Thu Oct 20 13:14:50 CEST 2022
From: Vidya Sagar Velumuri <vvelumuri at marvell.com>
Acquire locks in antireplay logic to avoid race condition
Signed-off-by: Vidya Sagar Velumuri <vvelumuri at marvell.com>
---
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index 2a5c00eadd..04c004bc7a 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -500,6 +500,7 @@ ipsec_antireplay_check(struct cn9k_sec_session *sess, uint32_t win_sz,
if (unlikely(seq == 0))
return IPSEC_ANTI_REPLAY_FAILED;
+ rte_spinlock_lock(&sess->ar.lock);
ret = cnxk_on_anti_replay_check(seq, &sess->ar, win_sz);
if (esn && !ret) {
esn_low = rte_be_to_cpu_32(common_sa->seq_t.tl);
@@ -510,6 +511,7 @@ ipsec_antireplay_check(struct cn9k_sec_session *sess, uint32_t win_sz,
common_sa->seq_t.th = rte_cpu_to_be_32(seqh);
}
}
+ rte_spinlock_unlock(&sess->ar.lock);
return ret;
}
--
2.25.1
More information about the dev
mailing list