crypto: hisilicon/sec - fix for sgl unmmap problem
authorWenkai Lin <linwenkai6@hisilicon.com>
Fri, 15 Sep 2023 09:13:29 +0000 (17:13 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 20 Sep 2023 05:15:54 +0000 (13:15 +0800)
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/hisilicon/sec2/sec_crypto.c

index 074e50ef512c117bdbe8904393f9150f5dfde5b5..ed77711e809e612ffe08a926693ac540abdf8d84 100644 (file)
@@ -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;
                }
        }