[10/13] crypto/cnxk: acquire lock while updating antireplay
Commit Message
From: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Acquire locks in antireplay logic to avoid race condition
Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
---
drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 2 ++
1 file changed, 2 insertions(+)
@@ -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;
}