crypto: ccree - fix backlog notifications
We were doing backlog notification callbacks via a cipher/hash/aead request structure cast to the base structure, which may or may not work based on how the structure is laid in memory and is not safe. Fix it by delegating the backlog notification to the appropriate internal callbacks which are type aware. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:

committed by
Herbert Xu

parent
dcf6285d18
commit
a108f9311c
@@ -818,9 +818,13 @@ static void cc_cipher_complete(struct device *dev, void *cc_req, int err)
|
||||
struct crypto_skcipher *sk_tfm = crypto_skcipher_reqtfm(req);
|
||||
unsigned int ivsize = crypto_skcipher_ivsize(sk_tfm);
|
||||
|
||||
cc_unmap_cipher_request(dev, req_ctx, ivsize, src, dst);
|
||||
memcpy(req->iv, req_ctx->iv, ivsize);
|
||||
kzfree(req_ctx->iv);
|
||||
if (err != -EINPROGRESS) {
|
||||
/* Not a BACKLOG notification */
|
||||
cc_unmap_cipher_request(dev, req_ctx, ivsize, src, dst);
|
||||
memcpy(req->iv, req_ctx->iv, ivsize);
|
||||
kzfree(req_ctx->iv);
|
||||
}
|
||||
|
||||
skcipher_request_complete(req, err);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user