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
@@ -280,8 +280,12 @@ static void cc_update_complete(struct device *dev, void *cc_req, int err)
|
||||
|
||||
dev_dbg(dev, "req=%pK\n", req);
|
||||
|
||||
cc_unmap_hash_request(dev, state, req->src, false);
|
||||
cc_unmap_req(dev, state, ctx);
|
||||
if (err != -EINPROGRESS) {
|
||||
/* Not a BACKLOG notification */
|
||||
cc_unmap_hash_request(dev, state, req->src, false);
|
||||
cc_unmap_req(dev, state, ctx);
|
||||
}
|
||||
|
||||
req->base.complete(&req->base, err);
|
||||
}
|
||||
|
||||
@@ -295,9 +299,13 @@ static void cc_digest_complete(struct device *dev, void *cc_req, int err)
|
||||
|
||||
dev_dbg(dev, "req=%pK\n", req);
|
||||
|
||||
cc_unmap_hash_request(dev, state, req->src, false);
|
||||
cc_unmap_result(dev, state, digestsize, req->result);
|
||||
cc_unmap_req(dev, state, ctx);
|
||||
if (err != -EINPROGRESS) {
|
||||
/* Not a BACKLOG notification */
|
||||
cc_unmap_hash_request(dev, state, req->src, false);
|
||||
cc_unmap_result(dev, state, digestsize, req->result);
|
||||
cc_unmap_req(dev, state, ctx);
|
||||
}
|
||||
|
||||
req->base.complete(&req->base, err);
|
||||
}
|
||||
|
||||
@@ -311,9 +319,13 @@ static void cc_hash_complete(struct device *dev, void *cc_req, int err)
|
||||
|
||||
dev_dbg(dev, "req=%pK\n", req);
|
||||
|
||||
cc_unmap_hash_request(dev, state, req->src, false);
|
||||
cc_unmap_result(dev, state, digestsize, req->result);
|
||||
cc_unmap_req(dev, state, ctx);
|
||||
if (err != -EINPROGRESS) {
|
||||
/* Not a BACKLOG notification */
|
||||
cc_unmap_hash_request(dev, state, req->src, false);
|
||||
cc_unmap_result(dev, state, digestsize, req->result);
|
||||
cc_unmap_req(dev, state, ctx);
|
||||
}
|
||||
|
||||
req->base.complete(&req->base, err);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user