mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
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. Signed-off-by: Rajat Gupta <rajgupt@qti.qualcomm.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: stable@vger.kernel.org Signed-off-by: Helge Deller <deller@gmx.de> |
||
|---|---|---|
| .. | ||
| backlight | ||
| console | ||
| fbdev | ||
| logo | ||
| aperture.c | ||
| cmdline.c | ||
| display_timing.c | ||
| hdmi.c | ||
| Kconfig | ||
| Makefile | ||
| nomodeset.c | ||
| of_display_timing.c | ||
| of_videomode.c | ||
| screen_info_generic.c | ||
| screen_info_pci.c | ||
| sticore.c | ||
| vgastate.c | ||
| videomode.c | ||