Skip to contentSkip to conversation

crypto: starfive - Do not free stack buffer

PATCH In review [email protected] 4 participants 5 messages Dec 3, 2024 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: starfive - Do not free stack buffer

From: Jia Jie Ho <[email protected]>

[ Upstream commit d7f01649f4eaf1878472d3d3f480ae1e50d98f6c ]

RSA text data uses variable length buffer allocated in software stack. Calling kfree on it causes undefined behaviour in subsequent operations.

---
 drivers/crypto/starfive/jh7110-rsa.c | 1 -
 1 file changed, 1 deletion(-)
drivers/crypto/starfive/jh7110-rsa.c +0 -1
index 1db9a3d02848..3116828d60a0 100644
@@ -303,7 +303,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;
 }
 
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 8 lines · On Tue, Dec 03, 2024 at 02:52:13PM +0800, [email protected] wrote:

From: Jia Jie Ho <[email protected]>

[ Upstream commit d7f01649f4eaf1878472d3d3f480ae1e50d98f6c ]

RSA text data uses variable length buffer allocated in software stack. Calling kfree on it causes undefined behaviour in subsequent operations.

The cc: says 6.7 and newer, and yet you are wanting this for 6.6.y? Why? Why ignore what the author asked for?

thanks,

greg k-h

#2 lore raw
Quoted 11 lines · Greg KH

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 7 lines · On Tue, Dec 03, 2024 at 02:52:13PM +0800, [email protected] wrote:

From: Jia Jie Ho <[email protected]>

[ Upstream commit d7f01649f4eaf1878472d3d3f480ae1e50d98f6c ]

RSA text data uses variable length buffer allocated in software stack. Calling kfree on it causes undefined behaviour in subsequent operations.

Quoted 7 lines
Quoted 1 line

The cc: says 6.7 and newer, and yet you are wanting this for 6.6.y? Why? Why ignore what the author asked for?

thanks,

greg k-h

I want to backport it to fix CVE-2024-39478.

Bin Lan

maintainer
#3 lore raw
Quoted 14 lines · Bin Lan
Quoted 12 lines · Greg KH

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 8 lines · On Tue, Dec 03, 2024 at 02:52:13PM +0800, [email protected] wrote:

From: Jia Jie Ho <[email protected]>

[ Upstream commit d7f01649f4eaf1878472d3d3f480ae1e50d98f6c ]

RSA text data uses variable length buffer allocated in software stack. Calling kfree on it causes undefined behaviour in subsequent operations.

Quoted 8 lines
Quoted 6 lines

The cc: says 6.7 and newer, and yet you are wanting this for 6.6.y? Why? Why ignore what the author asked for?

thanks,

greg k-h

I want to backport it to fix CVE-2024-39478.

Again, how do you know that that CVE is relevant for kernels older than 6.7.y? Have you tested this? Have you proved that 6.6.y needs this? If not, there's no way we can take it, nor would you want us to take it, right?

thanks,

greg k-h

maintainer
#4 lore raw
In reply to [email protected]

[ Sasha's backport helper bot ]

Hi,

The upstream commit SHA1 provided is correct: d7f01649f4eaf1878472d3d3f480ae1e50d98f6c

WARNING: Author mismatch between patch and upstream commit:
Backport author: [email protected] Commit author: Jia Jie Ho <[email protected]>

Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.11.y | Present (exact SHA1)
6.6.y | Not found

Note: The patch differs from the upstream commit:
---
1: d7f01649f4eaf ! 1: f914a30081e60 crypto: starfive - Do not free stack buffer
@@ Metadata
## Commit message ##
crypto: starfive - Do not free stack buffer

+ [ Upstream commit d7f01649f4eaf1878472d3d3f480ae1e50d98f6c ]
+
RSA text data uses variable length buffer allocated in software stack. Calling kfree on it causes undefined behaviour in subsequent operations.

+ Signed-off-by: Bin Lan <[email protected]>

## drivers/crypto/starfive/jh7110-rsa.c ##
@@ drivers/crypto/starfive/jh7110-rsa.c: static int starfive_rsa_enc_core(struct starfive_cryp_ctx *ctx, int enc)
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y        |  Success    |  Failed    |

Build Errors:
Build error for stable/linux-6.6.y: