# CVE-2024-39497: drm/shmem-helper: Fix BUG_ON() on mmap(PROT_WRITE, MAP_PRIVATE)

- 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.27%, higher than 21% of CVEs (2026-12-01)
- Published: 2024-07-12T12:20:32.330Z
- Modified: 2026-06-17T07:42:02.983Z
- Weaknesses: CWE-617
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: Linux

## Description

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

drm/shmem-helper: Fix BUG_ON() on mmap(PROT_WRITE, MAP_PRIVATE)

Lack of check for copy-on-write (COW) mapping in drm_gem_shmem_mmap
allows users to call mmap with PROT_WRITE and MAP_PRIVATE flag
causing a kernel panic due to BUG_ON in vmf_insert_pfn_prot:
BUG_ON((vma->vm_flags & VM_PFNMAP) && is_cow_mapping(vma->vm_flags));

Return -EINVAL early if COW mapping is detected.

This bug affects all drm drivers using default shmem helpers.
It can be reproduced by this simple example:
void *ptr = mmap(0, size, PROT_WRITE, MAP_PRIVATE, fd, mmap_offset);
ptr[0] = 0;

(As written by CVE List.)

## Affected

- Linux Linux: from 2194a63a818db71065ebe09c8104f5f021ca4e7b before a508a102edf8735adc9bb73d37dd13c38d1a1b10; from 2194a63a818db71065ebe09c8104f5f021ca4e7b before 3ae63a8c1685e16958560ec08d30defdc5b9cca0; from 2194a63a818db71065ebe09c8104f5f021ca4e7b before 2219e5f97244b79c276751a1167615b9714db1b0; from 2194a63a818db71065ebe09c8104f5f021ca4e7b before 1b4a8b89bf6787090b56424d269bf84ba00c3263; from 2194a63a818db71065ebe09c8104f5f021ca4e7b before 03c71c42809ef4b17f5d874cdb2d3bf40e847b86; from 2194a63a818db71065ebe09c8104f5f021ca4e7b before 39bc27bd688066a63e56f7f64ad34fae03fbe3b8; 5.2 (not affected: before 5.2; from 5.10.229 up to 5.10.*; from 5.15.169 up to 5.15.*; from 6.1.114 up to 6.1.*; from 6.6.35 up to 6.6.*; from 6.9.6 up to 6.9.*; from 6.10 up to *)
- linux linux_kernel: from 5.2 before 5.10.229; from 5.11 before 5.15.169; from 5.16 before 6.1.114; from 6.2 before 6.6.35; from 6.7 before 6.9.6; 6.10

## References

- <https://git.kernel.org/stable/c/a508a102edf8735adc9bb73d37dd13c38d1a1b10> (patch)
- <https://git.kernel.org/stable/c/3ae63a8c1685e16958560ec08d30defdc5b9cca0> (patch)
- <https://git.kernel.org/stable/c/2219e5f97244b79c276751a1167615b9714db1b0> (patch)
- <https://git.kernel.org/stable/c/1b4a8b89bf6787090b56424d269bf84ba00c3263> (patch)
- <https://git.kernel.org/stable/c/03c71c42809ef4b17f5d874cdb2d3bf40e847b86> (patch)
- <https://git.kernel.org/stable/c/39bc27bd688066a63e56f7f64ad34fae03fbe3b8> (patch)
- <https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html>
- <https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html>

## Sources

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

---

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