linux/drivers/video
Rajat Gupta 8de779dc40 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.

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>
2026-05-04 10:35:55 +02:00
..
backlight backlight: apple_bl: Convert to a platform driver 2026-03-31 11:48:10 +01:00
console lib/fonts: Create font_data_t from struct console_font with font_data_import() 2026-03-09 15:47:21 +01:00
fbdev fbdev: udlfb: add vm_ops to dlfb_ops_mmap to prevent use-after-free 2026-05-04 10:35:55 +02:00
logo video/logo: don't select LOGO_LINUX_MONO and LOGO_LINUX_VGA16 by default 2026-02-14 11:09:46 +01:00
aperture.c video/aperture: optionally match the device in sysfb_disable() 2024-08-26 19:14:48 -04:00
cmdline.c
display_timing.c
hdmi.c video: hdmi: Remove unused hdmi_infoframe_check 2024-12-22 07:03:42 +01:00
Kconfig Merge drm/drm-next into drm-misc-next 2026-02-23 11:48:20 +01:00
Makefile
nomodeset.c
of_display_timing.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
of_videomode.c
screen_info_generic.c video: screen_info: Add pixel-format helper for linear framebuffers 2025-08-26 09:54:16 +02:00
screen_info_pci.c sysfb: Replace screen_info with sysfb_primary_display 2025-12-16 14:12:44 +01:00
sticore.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
vgastate.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
videomode.c