crypto/cnxk: acquire lock for anti-replay

Acquired locks in antireplay logic to avoid race condition.

Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
This commit is contained in:
Vidya Sagar Velumuri 2022-10-20 16:44:50 +05:30 committed by Akhil Goyal
parent 5fc5e9d23b
commit e0cb7b8987

View File

@ -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;
}