Commit 009eeb98 authored by Hadar Gat's avatar Hadar Gat Committed by Greg Kroah-Hartman

crypto: ccree - fix free of unallocated mlli buffer

commit a4941195 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: default avatarHadar Gat <hadar.gat@arm.com>
Signed-off-by: default avatarGilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6f4c11b0
...@@ -614,10 +614,10 @@ void cc_unmap_aead_request(struct device *dev, struct aead_request *req) ...@@ -614,10 +614,10 @@ void cc_unmap_aead_request(struct device *dev, struct aead_request *req)
hw_iv_size, DMA_BIDIRECTIONAL); hw_iv_size, DMA_BIDIRECTIONAL);
} }
/*In case a pool was set, a table was /* Release pool */
*allocated and should be released if ((areq_ctx->assoc_buff_type == CC_DMA_BUF_MLLI ||
*/ areq_ctx->data_buff_type == CC_DMA_BUF_MLLI) &&
if (areq_ctx->mlli_params.curr_pool) { (areq_ctx->mlli_params.mlli_virt_addr)) {
dev_dbg(dev, "free MLLI buffer: dma=%pad virt=%pK\n", dev_dbg(dev, "free MLLI buffer: dma=%pad virt=%pK\n",
&areq_ctx->mlli_params.mlli_dma_addr, &areq_ctx->mlli_params.mlli_dma_addr,
areq_ctx->mlli_params.mlli_virt_addr); areq_ctx->mlli_params.mlli_virt_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment