diff options
Diffstat (limited to 'crypto/algif_aead.c')
-rw-r--r-- | crypto/algif_aead.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c index f138af18b500..379e83c8aa52 100644 --- a/crypto/algif_aead.c +++ b/crypto/algif_aead.c @@ -389,7 +389,7 @@ static int aead_check_key(struct socket *sock) struct alg_sock *ask = alg_sk(sk); lock_sock(sk); - if (ask->refcnt) + if (!atomic_read(&ask->nokey_refcnt)) goto unlock_child; psk = ask->parent; @@ -401,11 +401,8 @@ static int aead_check_key(struct socket *sock) if (!tfm->has_key) goto unlock; - if (!pask->refcnt++) - sock_hold(psk); - - ask->refcnt = 1; - sock_put(psk); + atomic_dec(&pask->nokey_refcnt); + atomic_set(&ask->nokey_refcnt, 0); err = 0; |