diff options
author | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2017-12-19 10:27:24 +0000 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-12-22 19:02:40 +1100 |
commit | 43f9357cf31ea12d38255736060cf7cb2e42a260 (patch) | |
tree | 18c02571c6e4219543ea76a9467781c1ff6f7dab /crypto/algif_aead.c | |
parent | 0adbd424763787f00d922a3ad017e579b80a3509 (diff) | |
download | linux-crypto-43f9357cf31ea12d38255736060cf7cb2e42a260.tar.gz linux-crypto-43f9357cf31ea12d38255736060cf7cb2e42a260.zip |
crypto: af_alg - Fix race around ctx->rcvused by making it atomic_t
This variable was increased and decreased without any protection.
Result was an occasional misscount and negative wrap around resulting
in false resource allocation failures.
Fixes: 6ec977292698 ("crypto: af_alg - remove locking in async callback")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | crypto/algif_aead.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c index b73db2b2..20df8c1b 100644 --- a/crypto/algif_aead.c +++ b/crypto/algif_aead.c @@ -571,7 +571,7 @@ static int aead_accept_parent_nokey(void *private, struct sock *sk) INIT_LIST_HEAD(&ctx->tsgl_list); ctx->len = len; ctx->used = 0; - ctx->rcvused = 0; + atomic_set(&ctx->rcvused, 0); ctx->more = 0; ctx->merge = 0; ctx->enc = 0; |