patch "staging: ccree: fix leak of import() after init()" added to staging-linus
Subsystems (2)
This is a note to let you know that I've just added the patch titled
staging: ccree: fix leak of import() after init()
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
Quoted 1 line
From
c5f39d07860c35e5e4c63188139465af790f86ceMon Sep 17 00:00:00 2001
From: Gilad Ben-Yossef <[email protected]>
Date: Thu, 9 Nov 2017 09:16:09 +0000
Subject: staging: ccree: fix leak of import() after init()
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.
--- drivers/staging/ccree/ssi_hash.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/ccree/ssi_hash.c +6 -3
@@ -1778,9 +1778,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 );
Signature · 1 line
2.15.0