summaryrefslogtreecommitdiff
path: root/crypto/xts.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-04-18 09:03:50 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-04-18 09:03:50 -0700
commita16c8279b123c3467e25511fc553f7ac2ca918bb (patch)
treed16497db8df2b976c259c5aa481a10bf33e06b1e /crypto/xts.c
parent69ef4995da43c512ffa7d4e57d5124489a0b417f (diff)
parente179633f9e479876cf8339df9f0a9f4e56f46ea0 (diff)
downloadlinux-crypto-a16c8279b123c3467e25511fc553f7ac2ca918bb.tar.gz
linux-crypto-a16c8279b123c3467e25511fc553f7ac2ca918bb.zip
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: "This fixes the following problems: - regression in new XTS/LRW code when used with async crypto - long-standing bug in ahash API when used with certain algos - bogus memory dereference in async algif_aead with certain algos" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: algif_aead - Fix bogus request dereference in completion function crypto: ahash - Fix EINPROGRESS notification callback crypto: lrw - Fix use-after-free on EINPROGRESS crypto: xts - Fix use-after-free on EINPROGRESS
Diffstat (limited to 'crypto/xts.c')
-rw-r--r--crypto/xts.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/xts.c b/crypto/xts.c
index c976bfac..89ace5eb 100644
--- a/crypto/xts.c
+++ b/crypto/xts.c
@@ -286,6 +286,13 @@ static void encrypt_done(struct crypto_async_request *areq, int err)
struct rctx *rctx;
rctx = skcipher_request_ctx(req);
+
+ if (err == -EINPROGRESS) {
+ if (rctx->left != req->cryptlen)
+ return;
+ goto out;
+ }
+
subreq = &rctx->subreq;
subreq->base.flags &= CRYPTO_TFM_REQ_MAY_BACKLOG;
@@ -293,6 +300,7 @@ static void encrypt_done(struct crypto_async_request *areq, int err)
if (rctx->left)
return;
+out:
skcipher_request_complete(req, err);
}
@@ -330,6 +338,13 @@ static void decrypt_done(struct crypto_async_request *areq, int err)
struct rctx *rctx;
rctx = skcipher_request_ctx(req);
+
+ if (err == -EINPROGRESS) {
+ if (rctx->left != req->cryptlen)
+ return;
+ goto out;
+ }
+
subreq = &rctx->subreq;
subreq->base.flags &= CRYPTO_TFM_REQ_MAY_BACKLOG;
@@ -337,6 +352,7 @@ static void decrypt_done(struct crypto_async_request *areq, int err)
if (rctx->left)
return;
+out:
skcipher_request_complete(req, err);
}