From: Vinay Kumar Yadav <vinay.ya...@chelsio.com> Date: Tue, 19 May 2020 13:13:27 +0530
> + spin_lock_bh(&ctx->encrypt_compl_lock); > + pending = atomic_read(&ctx->encrypt_pending); > + spin_unlock_bh(&ctx->encrypt_compl_lock); The sequence: lock(); x = p->y; unlock(); Does not fix anything, and is superfluous locking. The value of p->y can change right after the unlock() call, so you aren't protecting the atomic'ness of the read and test sequence because the test is outside of the lock.