CVE-2026-97604: fbdev: vfb: defer cleanup until the last reference
In the Linux kernel, the following vulnerability has been resolved:
fbdev: vfb: defer cleanup until the last reference
FBIOGETCMAP takes a shallow snapshot of info->cmap and performs the usercopy after dropping info->lock. vfbremove() frees the colormap immediately after unregistering the framebuffer, even when an open file still holds a reference to fbinfo. A concurrent driver unbind can therefore free the colormap while the ioctl copies it to userspace.
KASAN reports:
BUG: KASAN: slab-use-after-free in copytouser Read of size 512 by task poc/125
copytouser (./include/linux/instrumented.h:129 ./include/linux/uaccess.h:201 lib/usercopy.c:24) fbcmaptouser (./include/linux/uaccess.h:230 drivers/video/fbdev/core/fbcmap.c:211) dofbioctl (drivers/video/fbdev/core/fbchrdev.c:114)
Allocated by task 1: fballoccmapgfp (./include/linux/slab.h:973 ./include/linux/slab.h:1290 drivers/video/fbdev/core/fbcmap.c:108) vfbprobe (drivers/video/fbdev/vfb.c:459)
Freed by task 124: fbdealloccmap (drivers/video/fbdev/core/fbcmap.c:151) vfbremove (drivers/video/fbdev/vfb.c:489)
unregisterframebuffer() drops the registration reference, and fbdev calls fbdestroy after the last putfbinfo(). Move the registered framebuffer's cleanup into an fbdestroy callback so its colormap and screen buffer stay alive until all file references have been released.
Affected Software
Event History
Frequently Asked Questions
What conditions are required to trigger the use-after-free?
An open framebuffer file must still hold a reference to fb_info while a user issues FBIOGETCMAP. A concurrent unbind of the vfb driver must then remove the framebuffer and free its colormap after the ioctl takes its snapshot but before its copy to userspace completes.
Which systems are exposed?
The affected path is specific to the Linux kernel's virtual framebuffer driver (vfb) and its framebuffer colormap handling. Systems that do not use the vfb driver are not described as reaching this vulnerable remove path.
How can administrators reduce exposure before applying the fix?
Avoid unbinding or removing the vfb driver while framebuffer device files may remain open or while FBIOGETCMAP operations are in progress. Coordinating driver removal with closure of framebuffer users prevents the described race condition.
How would an affected event appear in diagnostics?
KASAN can report a slab use-after-free in _copy_to_user, with the call path including fb_cmap_to_user and do_fb_ioctl. The allocation is associated with vfb_probe, while the free is associated with vfb_remove and fb_dealloc_cmap.