diff mbox series

crypto: hisilicon/sec - fix for sgl unmmap problem

Message ID 20230915091329.31708-1-linwenkai6@hisilicon.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto: hisilicon/sec - fix for sgl unmmap problem | expand

Commit Message

linwenkai (C) Sept. 15, 2023, 9:13 a.m. UTC
When sec_aead_mac_init returns an error code, sec_cipher_map
will exit abnormally, the hardware sgl should be unmmaped.

Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
---
 drivers/crypto/hisilicon/sec2/sec_crypto.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Herbert Xu Sept. 20, 2023, 5:22 a.m. UTC | #1
On Fri, Sep 15, 2023 at 05:13:29PM +0800, Wenkai Lin wrote:
> When sec_aead_mac_init returns an error code, sec_cipher_map
> will exit abnormally, the hardware sgl should be unmmaped.
> 
> Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
> ---
>  drivers/crypto/hisilicon/sec2/sec_crypto.c | 1 +
>  1 file changed, 1 insertion(+)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c
index 074e50ef5..ed77711e8 100644
--- a/drivers/crypto/hisilicon/sec2/sec_crypto.c
+++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c
@@ -1011,6 +1011,7 @@  static int sec_cipher_map(struct sec_ctx *ctx, struct sec_req *req,
 		ret = sec_aead_mac_init(a_req);
 		if (unlikely(ret)) {
 			dev_err(dev, "fail to init mac data for ICV!\n");
+			hisi_acc_sg_buf_unmap(dev, src, req->in);
 			return ret;
 		}
 	}