Skip to content

Commit 009eeb9

Browse files
hadargatgregkh
authored andcommitted
crypto: ccree - fix free of unallocated mlli buffer
commit a494119 upstream. In cc_unmap_aead_request(), call dma_pool_free() for mlli buffer only if an item is allocated from the pool and not always if there is a pool allocated. This fixes a kernel panic when trying to free a non-allocated item. Cc: stable@vger.kernel.org Signed-off-by: Hadar Gat <hadar.gat@arm.com> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6f4c11b commit 009eeb9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎drivers/crypto/ccree/cc_buffer_mgr.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,10 +614,10 @@ void cc_unmap_aead_request(struct device *dev, struct aead_request *req)
614614
hw_iv_size, DMA_BIDIRECTIONAL);
615615
}
616616

617-
/*In case a pool was set, a table was
618-
*allocated and should be released
619-
*/
620-
if (areq_ctx->mlli_params.curr_pool) {
617+
/* Release pool */
618+
if ((areq_ctx->assoc_buff_type == CC_DMA_BUF_MLLI ||
619+
areq_ctx->data_buff_type == CC_DMA_BUF_MLLI) &&
620+
(areq_ctx->mlli_params.mlli_virt_addr)) {
621621
dev_dbg(dev, "free MLLI buffer: dma=%pad virt=%pK\n",
622622
&areq_ctx->mlli_params.mlli_dma_addr,
623623
areq_ctx->mlli_params.mlli_virt_addr);

0 commit comments

Comments
 (0)