CVE-2025-68763
Description
In the Linux kernel, the following vulnerability has been resolved:
crypto: starfive - Correctly handle return of sg_nents_for_len
The return value of sg_nents_for_len was assigned to an unsigned long in starfive_hash_digest, causing negative error codes to be converted to large positive integers.
Add error checking for sg_nents_for_len and return immediately on failure to prevent potential buffer overflows.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
In the Linux kernel's StarFive crypto driver, a signedness error in sg_nents_for_len error handling can turn negative error codes into large values, risking buffer overflow.
Vulnerability
In the Linux kernel's crypto subsystem, the StarFive driver's starfive_hash_digest function assigns the return value of sg_nents_for_len to an unsigned long. When sg_nents_for_len returns a negative error code (e.g., -EINVAL), this code is implicitly converted to a large positive integer due to unsigned type promotion [1]. This type mismatch arises because the function's return type is int, but the variable storing it is unsigned long.
Exploitation
An attacker could trigger this vulnerability by submitting a hash digest request with malformed or invalid scatter-gather list parameters to the StarFive crypto accelerator. The sg_nents_for_len call would then fail and return a negative value, which after unsigned conversion becomes a huge positive number. This corrupted count could then be used in subsequent operations without proper validation, potentially leading to out‑of‑bounds memory accesses [2]. No special privileges beyond access to the affected crypto device are required; the attack surface is local through the kernel's crypto API.
Impact
Successful exploitation could allow an attacker to cause a buffer overflow in the kernel's memory space, leading to system instability (denial of service) or, in principle, arbitrary code execution with kernel privileges. The specific impact depends on how the corrupted count is consumed in the message digest processing pipeline [3].
Mitigation
The fix adds explicit error checking for the return value of sg_nents_for_len and immediately returns the error code on failure, preventing the unsigned conversion from occurring. The patch has been applied to the stable Linux kernel branches. No workaround is available; users should update their kernels to the patched version [1].
AI Insight generated on May 19, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
1Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
5- git.kernel.org/stable/c/0c3854d65cc4402cb8c52d4d773450a06efecab6nvd
- git.kernel.org/stable/c/1af5c973dd744e29fa22121f43e8646b7a7a71a7nvd
- git.kernel.org/stable/c/6cd14414394b4f3d6e1ed64b8241d1fcc2271820nvd
- git.kernel.org/stable/c/9b3f71cf02e04cfaa482155e3078707fe7f8aef4nvd
- git.kernel.org/stable/c/e9eb52037a529fbb307c290e9951a62dd728b03dnvd
News mentions
0No linked articles in our index yet.