Skip to content

Commit

Permalink
crypto: starfive - Do not free stack buffer
Browse files Browse the repository at this point in the history
RSA text data uses variable length buffer allocated in software stack.
Calling kfree on it causes undefined behaviour in subsequent operations.

Cc: <[email protected]> torvalds#6.7+
Signed-off-by: Jia Jie Ho <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
jiajieho authored and herbertx committed May 10, 2024
1 parent 25ca4a8 commit d7f0164
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 @@ -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;
}

Expand Down

0 comments on commit d7f0164

Please sign in to comment.