fbdev: udlfb: add vm_ops to dlfb_ops_mmap to prevent use-after-free
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 7433914efd584b22bb49d3e1eee001f5d0525ecd · < da9b065cedfd3b574f229d5be594e6aa47a27ae6| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
fbdev: udlfb: add vm_ops to dlfb_ops_mmap to prevent use-after-free
dlfb_ops_mmap() uses remap_pfn_range() to map vmalloc framebuffer pages to userspace but sets no vm_ops on the VMA. This means the kernel cannot track active mmaps. When dlfb_realloc_framebuffer() replaces the backing buffer via FBIOPUT_VSCREENINFO, existing mmap PTEs are not invalidated. On USB disconnect, dlfb_ops_destroy() calls vfree() on the old pages while userspace PTEs still reference them, resulting in a use-after-free: the process retains read/write access to freed kernel pages.
Add vm_operations_struct with open/close callbacks that maintain an atomic mmap_count on struct dlfb_data. In dlfb_realloc_framebuffer(), check mmap_count and return -EBUSY if the buffer is currently mapped, preventing buffer replacement while userspace holds stale PTEs.
Tested with PoC using dummy_hcd + raw_gadget USB device emulation.
From the CVE record · Linux
The Linux kernel's udlfb driver does not track active framebuffer mappings. A local process with a framebuffer mapping can retain read/write access to freed kernel pages after framebuffer replacement and USB disconnect. The input does not specify authentication requirements.
Anyone running a Linux kernel with the udlfb driver should check their kernel version; affected versions are not specified.