* [PATCH] crypto: qce: fix uaf on qce_skcipher_register_one
@ 2021-11-04 13:46 Chengfeng Ye
2021-11-05 21:12 ` Thara Gopinath
2021-11-20 4:30 ` Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Chengfeng Ye @ 2021-11-04 13:46 UTC (permalink / raw)
To: thara.gopinath, herbert, davem, svarbanov
Cc: linux-kernel, linux-crypto, linux-arm-msm, Chengfeng Ye
Pointer alg points to sub field of tmpl, it
is dereferenced after tmpl is freed. Fix
this by accessing alg before free tmpl.
Fixes: ec8f5d8f ("crypto: qce - Qualcomm crypto engine driver")
Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
---
drivers/crypto/qce/skcipher.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c
index 8ff10928f581..3d27cd5210ef 100644
--- a/drivers/crypto/qce/skcipher.c
+++ b/drivers/crypto/qce/skcipher.c
@@ -484,8 +484,8 @@ static int qce_skcipher_register_one(const struct qce_skcipher_def *def,
ret = crypto_register_skcipher(alg);
if (ret) {
- kfree(tmpl);
dev_err(qce->dev, "%s registration failed\n", alg->base.cra_name);
+ kfree(tmpl);
return ret;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: qce: fix uaf on qce_skcipher_register_one
2021-11-04 13:46 [PATCH] crypto: qce: fix uaf on qce_skcipher_register_one Chengfeng Ye
@ 2021-11-05 21:12 ` Thara Gopinath
2021-11-20 4:30 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Thara Gopinath @ 2021-11-05 21:12 UTC (permalink / raw)
To: Chengfeng Ye, herbert, davem, svarbanov
Cc: linux-kernel, linux-crypto, linux-arm-msm
On 11/4/21 9:46 AM, Chengfeng Ye wrote:
> Pointer alg points to sub field of tmpl, it
> is dereferenced after tmpl is freed. Fix
> this by accessing alg before free tmpl.
>
> Fixes: ec8f5d8f ("crypto: qce - Qualcomm crypto engine driver")
> Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
Acked-by: Thara Gopinath <thara.gopinath@linaro.org>
> ---
> drivers/crypto/qce/skcipher.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c
> index 8ff10928f581..3d27cd5210ef 100644
> --- a/drivers/crypto/qce/skcipher.c
> +++ b/drivers/crypto/qce/skcipher.c
> @@ -484,8 +484,8 @@ static int qce_skcipher_register_one(const struct qce_skcipher_def *def,
>
> ret = crypto_register_skcipher(alg);
> if (ret) {
> - kfree(tmpl);
> dev_err(qce->dev, "%s registration failed\n", alg->base.cra_name);
> + kfree(tmpl);
> return ret;
> }
>
>
--
Warm Regards
Thara (She/Her/Hers)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: qce: fix uaf on qce_skcipher_register_one
2021-11-04 13:46 [PATCH] crypto: qce: fix uaf on qce_skcipher_register_one Chengfeng Ye
2021-11-05 21:12 ` Thara Gopinath
@ 2021-11-20 4:30 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2021-11-20 4:30 UTC (permalink / raw)
To: Chengfeng Ye
Cc: thara.gopinath, davem, svarbanov, linux-kernel, linux-crypto,
linux-arm-msm
On Thu, Nov 04, 2021 at 06:46:42AM -0700, Chengfeng Ye wrote:
> Pointer alg points to sub field of tmpl, it
> is dereferenced after tmpl is freed. Fix
> this by accessing alg before free tmpl.
>
> Fixes: ec8f5d8f ("crypto: qce - Qualcomm crypto engine driver")
> Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
> ---
> drivers/crypto/qce/skcipher.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [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:46 [PATCH] crypto: qce: fix uaf on qce_skcipher_register_one Chengfeng Ye
2021-11-05 21:12 ` 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).