# CVE-2024-38543: lib/test_hmm.c: handle src_pfns and dst_pfns allocation failure

- Severity: Medium 5.5 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.31%, higher than 16% of CVEs (2026-11-30)
- Published: 2024-06-19T13:35:17.994Z
- Modified: 2026-06-17T07:40:30.597Z
- Weaknesses: CWE-476
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: Linux

## Description

In the Linux kernel, the following vulnerability has been resolved:

lib/test_hmm.c: handle src_pfns and dst_pfns allocation failure

The kcalloc() in dmirror_device_evict_chunk() will return null if the
physical memory has run out.  As a result, if src_pfns or dst_pfns is
dereferenced, the null pointer dereference bug will happen.

Moreover, the device is going away.  If the kcalloc() fails, the pages
mapping a chunk could not be evicted.  So add a __GFP_NOFAIL flag in
kcalloc().

Finally, as there is no need to have physically contiguous memory, Switch
kcalloc() to kvcalloc() in order to avoid failing allocations.

(As written by CVE List.)

## Affected

- Linux Linux: from b2ef9f5a5cb37643ca5def3516c546457074b882 before 1a21fdeea502658e315bd939409b755974f4fb64; from b2ef9f5a5cb37643ca5def3516c546457074b882 before 65e528a69cb3ed4a286c45b4afba57461c8b5b33; from b2ef9f5a5cb37643ca5def3516c546457074b882 before ce47e8ead9a72834cc68431d53f8092ce69bebb7; from b2ef9f5a5cb37643ca5def3516c546457074b882 before 3b20d18f475bd17309db640dbe7d7c7ebb5bc2bc; from b2ef9f5a5cb37643ca5def3516c546457074b882 before c2af060d1c18beaec56351cf9c9bcbbc5af341a3; 5.8 (not affected: before 5.8; from 6.1.93 up to 6.1.*; from 6.6.33 up to 6.6.*; from 6.8.12 up to 6.8.*; from 6.9.3 up to 6.9.*; from 6.10 up to *)
- linux linux_kernel: from 5.8 before 6.1.93; from 6.2 before 6.6.33; from 6.7 before 6.8.12; from 6.9 before 6.9.3

## References

- <https://git.kernel.org/stable/c/1a21fdeea502658e315bd939409b755974f4fb64> (patch)
- <https://git.kernel.org/stable/c/65e528a69cb3ed4a286c45b4afba57461c8b5b33> (patch)
- <https://git.kernel.org/stable/c/ce47e8ead9a72834cc68431d53f8092ce69bebb7> (patch)
- <https://git.kernel.org/stable/c/3b20d18f475bd17309db640dbe7d7c7ebb5bc2bc> (patch)
- <https://git.kernel.org/stable/c/c2af060d1c18beaec56351cf9c9bcbbc5af341a3> (patch)

## Sources

- CVE List: [CVE-2024-38543](https://www.cve.org/CVERecord?id=CVE-2024-38543), CVE Terms of Use, modified 2026-05-11
- NVD: [CVE-2024-38543](https://nvd.nist.gov/vuln/detail/CVE-2024-38543), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2024-38543 · Whole record: https://cve.day/CVE-2024-38543.json · Rebuilt by cve.day 2026-11-25T22:58:42.007Z
