diff options
author | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2017-12-19 05:27:24 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-12-22 03:02:40 -0500 |
commit | af955bf15d2c27496b0269b1f05c26f758c68314 (patch) | |
tree | 93a46f7d3a6038882d956007e9b8a927df37b36c /crypto/algif_skcipher.c | |
parent | e57121d08c38dabec15cf3e1e2ad46721af30cae (diff) |
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: 7d2c3f54e6f6 ("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 'crypto/algif_skcipher.c')
-rw-r--r-- | crypto/algif_skcipher.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c index baef9bfccdda..c5c47b680152 100644 --- a/crypto/algif_skcipher.c +++ b/crypto/algif_skcipher.c | |||
@@ -390,7 +390,7 @@ static int skcipher_accept_parent_nokey(void *private, struct sock *sk) | |||
390 | INIT_LIST_HEAD(&ctx->tsgl_list); | 390 | INIT_LIST_HEAD(&ctx->tsgl_list); |
391 | ctx->len = len; | 391 | ctx->len = len; |
392 | ctx->used = 0; | 392 | ctx->used = 0; |
393 | ctx->rcvused = 0; | 393 | atomic_set(&ctx->rcvused, 0); |
394 | ctx->more = 0; | 394 | ctx->more = 0; |
395 | ctx->merge = 0; | 395 | ctx->merge = 0; |
396 | ctx->enc = 0; | 396 | ctx->enc = 0; |