CVE-2025-40062
Description
In the Linux kernel, the following vulnerability has been resolved:
crypto: hisilicon/qm - set NULL to qm->debug.qm_diff_regs
When the initialization of qm->debug.acc_diff_reg fails, the probe process does not exit. However, after qm->debug.qm_diff_regs is freed, it is not set to NULL. This can lead to a double free when the remove process attempts to free it again. Therefore, qm->debug.qm_diff_regs should be set to NULL after it is freed.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
A double-free vulnerability in the Linux kernel's hisilicon/qm driver occurs when probe failure leaves a freed pointer not set to NULL, leading to a double free on remove.
Vulnerability
In the Linux kernel's hisilicon/qm crypto driver, a double-free vulnerability exists in the probe and remove functions. When the initialization of qm->debug.acc_diff_reg fails, the probe process does not exit, but qm->debug.qm_diff_regs is freed without setting the pointer to NULL. This oversight can cause a double free when the remove function later attempts to free the same pointer again [1][2].
Exploitation
An attacker with the ability to load and unload the hisilicon/qm driver could trigger the vulnerability by causing the initialization of acc_diff_reg to fail (e.g., through resource exhaustion or hardware misconfiguration). The subsequent removal of the driver would then attempt to free the already-freed qm_diff_regs pointer, leading to memory corruption.
Impact
A double free in kernel memory can result in system instability, denial of service (kernel panic), or potentially arbitrary code execution in the kernel context, depending on the memory allocator state. This vulnerability is classified as a high-severity issue due to the risk of privilege escalation or system compromise.
Mitigation
The fix, which sets qm->debug.qm_diff_regs to NULL after freeing it, has been applied to the stable kernel trees. Users should update to a kernel version containing the commits referenced in [1] and [2] to eliminate the double-free condition.
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
2Patches
5a7836260d5121750f1ec143ea87a21a562447226a0650ad5f0cafb02de88Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- git.kernel.org/stable/c/1750f1ec143ebabdbdfa013668665c9d5042c430nvd
- git.kernel.org/stable/c/7226a0650ad5705bd8d39a11be270fa21ed1e6a5nvd
- git.kernel.org/stable/c/a7836260d5121949ba734e840d42a86ab4a32fccnvd
- git.kernel.org/stable/c/a87a21a56244b8f4eb357f6bad879247005bbe38nvd
- git.kernel.org/stable/c/f0cafb02de883b3b413d34eb079c9680782a9cc1nvd
News mentions
0No linked articles in our index yet.