linux/include/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>
History 2026-05-04 10:35:55 +02:00
..
atmel_lcdc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
aty128.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
broadsheetfb.h broadsheetfb: support storing waveform 2010-03-12 15:52:34 -08:00
cirrus.h cirrusfb: Laguna chipset 8bpp fix 2009-04-01 08:59:27 -07:00
cmdline.h
cvisionppc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
display_timing.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 428 2019-06-05 17:37:16 +02:00
edid.h
gbe.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 351 2019-06-05 17:37:08 +02:00
hecubafb.h
ili9320.h
imx-ipu-image-convert.h fbdev: ipu-v3: clean up kernel-doc warnings 2026-04-28 14:18:51 +02:00
imx-ipu-v3.h gpu: ipu-v3 ipu-cpmem: Remove unused functions 2025-03-01 11:29:03 +02:00
kyro.h fbdev: kyro: Remove unused declarations 2023-08-15 23:39:33 +02:00
mach64.h
maxinefb.h
metronomefb.h
mipi_display.h drm/dsi: rename MIPI_DCS_SET_PARTIAL_AREA to MIPI_DCS_SET_PARTIAL_ROWS 2019-11-07 14:59:56 +02:00
mmp_disp.h
neomagic.h
newport.h
nomodeset.h
of_display_timing.h video: of_display_timing.h: include errno.h 2022-07-06 17:16:20 +02:00
of_videomode.h
omapfb_dss.h
omapvrfb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
permedia2.h
pixel_format.h
platform_lcd.h backlight: platform_lcd: Remove match_fb from struct plat_lcd_data 2024-09-30 16:49:42 +01:00
pm3fb.h pm3fb: header file cleanup 2007-10-16 09:43:18 -07:00
pmag-ba-fb.h
pmagb-b-fb.h
pxa168fb.h
radeon.h
s1d13xxxfb.h
sa1100fb.h FB: sa1100: remove global sa1100fb_.*_power function pointers 2012-02-21 11:56:19 +00:00
samsung_fimd.h
sh_mobile_lcdc.h
sisfb.h
sstfb.h video: fbdev: sstfb: Updated logging to fix set but not used warnings 2020-11-30 20:04:59 +01:00
sticore.h
tdfx.h
tgafb.h tgafb: actually allocate memory for the pseudo_palette 2007-07-17 10:23:12 -07:00
trident.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
udlfb.h
uvesafb.h fbdev: uvesafb: Remove uvesafb_exec() prototype from include/video/uvesafb.h 2023-10-16 23:19:34 +02:00
vga.h video/vga: Add VGA_IS0_R 2026-01-23 05:20:28 +02:00
videomode.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 428 2019-06-05 17:37:16 +02:00