CVE-2024-40915
kernel: riscv: rewrite __kernel_map_pages() to fix sleeping in invalid context
Severity
ModerateRed Hat Product Security
CVSS 3.1
Review impact separately from score.
Published · July 12, 2024
Updated · November 21, 2025
Description
A flaw was found in the __kernel_map_pages() function in RISC-V in the Linux Kernel, which is incorrectly designed to sleep in atomic contexts. This function cleared the valid bit in page table entries for deallocated pages to detect illegal memory accesses, but it utilized __set_memory(), which acquires a semaphore that can sleep. As a result, this leads to warnings indicating a sleeping function is called from an invalid context.
Statement
Red Hat Enterprise Linux is not vulnerable to this CVE, as it does not affect the versions or configurations of the Linux kernel used in its distributions.
CVSS score applicability
The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.
Mitigation
Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.
CVSS / CWE
CVSS 3.1 · 4.1CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:H
CWE-1322 · Use of Blocking Code in Single-threaded, Non-blocking Context