diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2020-07-03 08:05:59 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2020-07-03 08:05:59 -0300 |
commit | 9434628fcee63b1f3c6a6881b70e8f69a1f68e88 (patch) | |
tree | 255d093aeda6c125f0158e883eb2bf400bb7f737 /crypto/algif_hash.c | |
parent | c42ad5d4358230be166fc36c87bae0dd1680c570 (diff) | |
parent | cdd3bb54332f82295ed90cd0c09c78cd0c0ee822 (diff) | |
download | linux-9434628fcee63b1f3c6a6881b70e8f69a1f68e88.tar.bz2 |
Merge remote-tracking branch 'torvalds/master' into perf/urgent
To synchronize UAPI headers.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'crypto/algif_hash.c')
-rw-r--r-- | crypto/algif_hash.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c index da1ffa4f7f8d..e71727c25a7d 100644 --- a/crypto/algif_hash.c +++ b/crypto/algif_hash.c @@ -301,7 +301,7 @@ static int hash_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; @@ -313,11 +313,8 @@ static int hash_check_key(struct socket *sock) if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_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; |