libwd/0076-uadk-v1-drv-hisi_zip_udrv-fix-unmap-buffer-for-lz77_.patch
2023-11-23 10:41:04 +08:00

37 lines
1.3 KiB
Diff

From 35d1a4ff23a7ed21d48e98e2264af61281323532 Mon Sep 17 00:00:00 2001
From: Yang Shen <shenyang39@huawei.com>
Date: Mon, 20 Nov 2023 15:21:52 +0800
Subject: [PATCH 76/85] uadk/v1/drv: hisi_zip_udrv - fix unmap buffer for
lz77_zstd stream mode
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@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.25.1