mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] crypto: hisilicon: use kfree_sensitive() for pool cleanup
@ 2025-05-23 13:30 Zilin Guan
  2025-05-24  0:25 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Zilin Guan @ 2025-05-23 13:30 UTC (permalink / raw)
  To: qianweili
  Cc: wangzhou1, herbert, davem, linux-crypto, linux-kernel,
	jianhao.xu, Zilin Guan

The error path of hisi_acc_create_sgl_pool() already calls
kfree_sensitive() to wipe sensitive data before freeing the pool.
However, hisi_acc_free_sgl_pool() currently uses plain kfree(), which
may leave secrets behind in memory and undo the protection applied
during creation.

This patch replaces kfree() with kfree_sensitive() in
hisi_acc_free_sgl_pool(), ensuring that all SGL pool deallocations
securely clear their contents.

Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
---
 drivers/crypto/hisilicon/sgl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/hisilicon/sgl.c b/drivers/crypto/hisilicon/sgl.c
index c974f95cd126..6a88a2056708 100644
--- a/drivers/crypto/hisilicon/sgl.c
+++ b/drivers/crypto/hisilicon/sgl.c
@@ -151,7 +151,7 @@ void hisi_acc_free_sgl_pool(struct device *dev, struct hisi_acc_sgl_pool *pool)
 		dma_free_coherent(dev, block[i].size, block[i].sgl,
 				  block[i].sgl_dma);
 
-	kfree(pool);
+	kfree_sensitive(pool);
 }
 EXPORT_SYMBOL_GPL(hisi_acc_free_sgl_pool);
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-24  0:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-23 13:30 [PATCH] crypto: hisilicon: use kfree_sensitive() for pool cleanup Zilin Guan
2025-05-24  0:25 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®