Skip to content

Commit

Permalink
crypto: starfive - Do not free stack buffer
Browse files Browse the repository at this point in the history
commit d7f0164 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
jiajieho authored and gregkh committed Jun 16, 2024
1 parent 0c31344 commit 5944de1
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion drivers/crypto/starfive/jh7110-rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,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;
}

Expand Down

0 comments on commit 5944de1

Please sign in to comment.