[PATCH 4/4] crypto: hisilicon/qm - fix uacce leak when SVA is not supported
From: Weili Qian
Date: Thu Sep 24 2026 - 07:42:28 EST
In qm_alloc_uacce(), when SVA is not supported, the error path calls
qm_remove_uacce(qm). But qm->uacce is not yet assigned and qm->use_sva
is still false, so qm_remove_uacce() returns without releasing the
uacce device, causing a memory leak.
Call uacce_remove(uacce) on the local variable instead.
Fixes: cd0ac51c5760 ("crypto: hisilicon/qm - define the device isolation strategy")
Signed-off-by: Weili Qian <qianweili@xxxxxxxxxx>
---
drivers/crypto/hisilicon/qm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index f310edfc16cf..096f0b40b82a 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -2968,7 +2968,7 @@ static int qm_alloc_uacce(struct hisi_qm *qm)
qm->use_sva = true;
} else {
/* only consider sva case */
- qm_remove_uacce(qm);
+ uacce_remove(uacce);
return -EINVAL;
}
--
2.43.0