From: Jia Jie Ho <jiajie.ho@starfivetech.com> Date: Mon, 29 Apr 2024 06:06:39 +0000 (+0800) Subject: crypto: starfive - Do not free stack buffer X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d7f01649f4eaf1878472d3d3f480ae1e50d98f6c;p=linux.git crypto: starfive - Do not free stack buffer RSA text data uses variable length buffer allocated in software stack. Calling kfree on it causes undefined behaviour in subsequent operations. Cc: <stable@vger.kernel.org> #6.7+ Signed-off-by: Jia Jie Ho <jiajie.ho@starfivetech.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> --- diff --git a/drivers/crypto/starfive/jh7110-rsa.c b/drivers/crypto/starfive/jh7110-rsa.c index 4d7eb3d1e764b..33093ba4b13af 100644 --- a/drivers/crypto/starfive/jh7110-rsa.c +++ b/drivers/crypto/starfive/jh7110-rsa.c @@ -276,7 +276,6 @@ static int starfive_rsa_enc_core(struct starfive_cryp_ctx *ctx, int enc) err_rsa_crypt: writel(STARFIVE_RSA_RESET, cryp->base + STARFIVE_PKA_CACR_OFFSET); - kfree(rctx->rsa_data); return ret; }