mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-13 14:14:37 +00:00
staging: ccree: fix leak of import() after init()
commitc5f39d0786
upstream. crypto_ahash_import() may be called either after crypto_ahash_init() or without such call. Right now we always internally call init() as part of import(), thus leaking memory and mappings if the user has already called init() herself. Fix this by only calling init() internally if the state is not already initialized. Fixes: commit454527d0d9
("staging: ccree: fix hash import/export") Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
779bfa90bd
commit
a633c7ed4a
1 changed files with 6 additions and 3 deletions
|
@ -1790,9 +1790,12 @@ static int ssi_ahash_import(struct ahash_request *req, const void *in)
|
|||
}
|
||||
in += sizeof(u32);
|
||||
|
||||
rc = ssi_hash_init(state, ctx);
|
||||
if (rc)
|
||||
goto out;
|
||||
/* call init() to allocate bufs if the user hasn't */
|
||||
if (!state->digest_buff) {
|
||||
rc = ssi_hash_init(state, ctx);
|
||||
if (rc)
|
||||
goto out;
|
||||
}
|
||||
|
||||
dma_sync_single_for_cpu(dev, state->digest_buff_dma_addr,
|
||||
ctx->inter_digestsize, DMA_BIDIRECTIONAL);
|
||||
|
|
Loading…
Reference in a new issue