In uadk v1, the library will alloc a ctx_buffer used for storing
stream information. On hisilicon platform, the hardware will output
some data to this buffer. So the ctx_buffer should be map to PA/IOVA.
But here the lz77_zstd forgot to unmap this buffer on error branch.
What's more, if the user use the wd_bmm ops, the unmap is a void
function.
Signed-off-by: Yang Shen <shenyang39(a)huawei.com>
---
v1/drv/hisi_zip_udrv.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/v1/drv/hisi_zip_udrv.c b/v1/drv/hisi_zip_udrv.c
index f820b7f..470acb9 100644
--- a/v1/drv/hisi_zip_udrv.c
+++ b/v1/drv/hisi_zip_udrv.c
@@ -512,6 +512,9 @@ static int fill_zip_addr_lz77_zstd(void *ssqe,
unmap_phy_seq:
drv_iova_unmap(q, zstd_out->literal, (void *)phy_lit, zstd_out->lit_sz);
unmap_phy_lit:
+ if (msg->stream_mode == WCRYPTO_COMP_STATEFUL)
+ drv_iova_unmap(q, msg->ctx_buf, (void *)addr.ctxbuf_addr - CTX_BUFFER_OFFSET,
+ MAX_CTX_RSV_SIZE);
drv_iova_unmap(q, msg->src, (void *)addr.source_addr, msg->in_size);
return -WD_ENOMEM;
}
--
2.33.0