CVE-2025-40336: drm/gpusvm: fix hmm_pfn_to_map_order() usage
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
drm/gpusvm: fix hmm_pfn_to_map_order() usage
Handle the case where the hmm range partially covers a huge page (like 2M), otherwise we can potentially end up doing something nasty like mapping memory which is outside the range, and maybe not even mapped by the mm. Fix is based on the xe userptr code, which in a future patch will directly use gpusvm, so needs alignment here.
v2:
- Add kernel-doc (Matt B)
- s/fls/ilog2/ (Thomas)
The Linux kernel CVE team has assigned CVE-2025-40336 to this issue.
Affected and fixed versions
===========================
Fixed in 6.17.8 with commit 08e9fd78ba1b9e95141181c69cc51795c9888157 Fixed in 6.18 with commit c50729c68aaf93611c855752b00e49ce1fdd1558
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2025-40336
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
drivers/gpu/drm/drm_gpusvm.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/08e9fd78ba1b9e95141181c69cc51795c9888157 https://git.kernel.org/stable/c/c50729c68aaf93611c855752b00e49ce1fdd1558