linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: qce: fix uaf on qce_ahash_register_one
@ 2021-11-04 13:38 Chengfeng Ye
  2021-11-05 21:10 ` Thara Gopinath
  2021-11-20  4:30 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Chengfeng Ye @ 2021-11-04 13:38 UTC (permalink / raw)
  To: thara.gopinath, herbert, davem, svarbanov
  Cc: linux-kernel, linux-crypto, linux-arm-msm, Chengfeng Ye

Pointer base points to sub field of tmpl, it
is dereferenced after tmpl is freed. Fix
this by accessing base before free tmpl.

Fixes: ec8f5d8f ("crypto: qce - Qualcomm crypto engine driver")
Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
---
 drivers/crypto/qce/sha.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c
index 8e6fcf2c21cc..59159f5e64e5 100644
--- a/drivers/crypto/qce/sha.c
+++ b/drivers/crypto/qce/sha.c
@@ -498,8 +498,8 @@ static int qce_ahash_register_one(const struct qce_ahash_def *def,
 
 	ret = crypto_register_ahash(alg);
 	if (ret) {
-		kfree(tmpl);
 		dev_err(qce->dev, "%s registration failed\n", base->cra_name);
+		kfree(tmpl);
 		return ret;
 	}
 
-- 
2.17.1


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

end of thread, other threads:[~2021-11-20  4:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04 13:38 [PATCH] crypto: qce: fix uaf on qce_ahash_register_one Chengfeng Ye
2021-11-05 21:10 ` Thara Gopinath
2021-11-20  4:30 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).