summaryrefslogtreecommitdiffstats
path: root/crypto/algif_aead.c
diff options
context:
space:
mode:
authorJonathan Cameron2017-12-19 11:27:24 +0100
committerHerbert Xu2017-12-22 09:02:40 +0100
commitaf955bf15d2c27496b0269b1f05c26f758c68314 (patch)
tree93a46f7d3a6038882d956007e9b8a927df37b36c /crypto/algif_aead.c
parentcrypto: chacha20poly1305 - validate the digest size (diff)
downloadkernel-qcow2-linux-af955bf15d2c27496b0269b1f05c26f758c68314.tar.gz
kernel-qcow2-linux-af955bf15d2c27496b0269b1f05c26f758c68314.tar.xz
kernel-qcow2-linux-af955bf15d2c27496b0269b1f05c26f758c68314.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: 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_aead.c')
-rw-r--r--crypto/algif_aead.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c
index b73db2b27656..20df8c1b6851 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;