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
..
2026-04-22 15:55:48 +02:00
2026-04-28 14:18:51 +02:00
2025-05-02 10:23:47 +02:00
2025-12-02 20:15:51 +01:00
2025-07-27 19:56:51 +02:00
2026-03-21 07:12:12 +01:00
2025-09-30 23:21:34 +02:00
2026-02-21 20:03:00 -08:00
2026-02-21 17:09:51 -08:00
2026-03-10 18:40:21 +01:00
2026-04-09 10:26:11 +02:00
2026-02-14 11:07:12 +01:00
2026-04-22 15:45:38 +02:00
2025-06-16 09:08:06 +02:00
2026-03-10 17:32:35 +01:00
2023-10-19 12:54:16 +02:00
2023-11-29 12:20:08 +01:00
2024-10-08 21:47:18 +02:00
2024-10-08 21:47:18 +02:00
2026-02-21 20:03:00 -08:00
2023-08-04 15:54:34 +02:00
2023-10-19 12:54:38 +02:00
2024-11-04 14:25:33 +10:00
2026-03-05 17:35:12 +01:00
2026-02-14 11:09:47 +01:00
2024-10-08 21:47:18 +02:00
2024-10-15 10:07:32 +02:00
2025-06-16 09:06:58 +02:00
2025-06-16 09:06:58 +02:00
2026-02-21 17:09:51 -08:00
2025-05-31 10:24:01 +02:00
2024-10-15 10:07:32 +02:00
2024-10-15 10:07:32 +02:00
2024-10-15 10:07:32 +02:00
2024-09-30 16:35:28 +02:00
2023-10-19 12:54:52 +02:00
2026-04-22 16:46:40 +02:00
2026-04-22 16:46:40 +02:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2025-06-16 09:07:03 +02:00
2023-10-19 12:55:07 +02:00
2025-12-16 14:12:44 +01:00
2024-10-08 21:47:18 +02:00
2026-02-14 11:09:47 +01:00
2023-08-04 15:54:35 +02:00
2025-03-26 22:39:21 +01:00
2023-09-02 08:18:40 -07:00
2025-11-15 13:46:45 +01:00
2026-03-09 13:06:48 +01:00
2024-10-08 21:47:18 +02:00
2025-11-15 13:46:45 +01:00
2024-10-08 21:47:18 +02:00
2026-04-22 17:02:55 +02:00
2024-10-08 21:47:18 +02:00
2024-08-30 18:42:38 +02:00
2024-01-18 21:10:41 +01:00
2024-09-02 13:54:26 +02:00
2025-07-27 19:56:51 +02:00
2026-03-21 07:11:34 +01:00
2024-10-15 10:07:32 +02:00
2026-03-09 13:06:48 +01:00
2025-06-16 09:06:19 +02:00
2026-02-14 11:07:12 +01:00
2023-08-04 15:54:36 +02:00
2024-10-08 21:47:18 +02:00
2026-02-21 17:09:51 -08:00
2024-10-08 21:47:18 +02:00
2026-04-22 15:45:38 +02:00
2024-10-15 10:07:32 +02:00
2024-10-08 21:47:18 +02:00
2023-10-19 12:56:00 +02:00
2023-10-19 12:56:04 +02:00
2023-08-04 15:54:37 +02:00
2023-08-04 15:54:37 +02:00
2023-08-04 15:54:37 +02:00
2023-11-29 12:20:44 +01:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2024-10-08 21:47:18 +02:00
2025-12-02 19:49:10 +01:00
2023-08-04 15:54:38 +02:00
2024-10-08 21:47:18 +02:00
2024-10-08 21:47:18 +02:00
2025-09-30 23:21:34 +02:00
2023-11-29 12:20:44 +01:00
2025-06-16 09:06:19 +02:00
2024-10-15 10:07:32 +02:00
2024-11-14 15:26:27 +01:00
2026-02-21 17:09:51 -08:00
2026-02-21 17:09:51 -08:00
2023-07-24 16:50:38 +02:00
2026-02-21 17:09:51 -08:00
2023-11-29 12:20:10 +01:00
2026-02-21 20:03:00 -08:00
2025-12-05 11:29:14 +01:00
2024-10-15 10:07:31 +02:00
2024-01-23 09:13:24 +01:00
2023-10-19 12:56:55 +02:00
2023-08-24 07:26:06 +10:00
2023-08-24 07:26:06 +10:00
2025-12-02 19:44:05 +01:00
2026-04-10 16:54:35 +02:00
2024-01-27 19:03:51 -08:00
2025-12-02 20:08:35 +01:00
2026-05-04 10:35:55 +02:00
2026-02-21 20:03:00 -08:00
2026-02-21 01:02:28 -08:00
2025-12-16 14:12:44 +01:00
2024-10-08 21:47:18 +02:00
2025-12-16 14:12:44 +01:00
2026-02-14 11:09:46 +01:00
2024-03-16 08:29:48 +01:00
2024-10-08 21:47:18 +02:00
2026-03-09 13:06:48 +01:00
2026-02-21 17:09:51 -08:00
2024-10-08 21:47:18 +02:00