linux/drivers/video/fbdev/core
Ian Bridges 7f08fc10fa fbdev: Fix fb_new_modelist to prevent null-ptr-deref in fb_videomode_to_var
info->var, a framebuffer's current mode, is expected to have a matching
entry in info->modelist. var_to_display() relies on this and treats a
failed fb_match_mode() as "This should not happen". fb_set_var() keeps it
true by adding the mode to the list on every change, and
do_register_framebuffer() does the same at registration.

store_modes() replaces the modelist from userspace. fb_new_modelist()
validates the new modes but does not check that info->var still has a
match. It relies on fbcon_new_modelist() to re-point consoles, but that
only handles consoles mapped to the framebuffer. With fbcon unbound there
are none, so info->var is left describing a mode that is no longer in the
list.

A later console takeover runs var_to_display(), where fb_match_mode()
returns NULL and leaves fb_display[i].mode NULL. fbcon_switch() passes it
to display_to_var(), and fb_videomode_to_var() dereferences the NULL mode.

Keep the current mode in the list in fb_new_modelist(), the same way
fb_set_var() does.

Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Ian Bridges <icb@fastmail.org>
Signed-off-by: Helge Deller <deller@gmx.de>
2026-06-26 15:12:45 +02:00
..
bitblit.c fbcon: Fill cursor mask in helper function 2026-04-07 17:38:07 +02:00
cfbcopyarea.c fbdev: Include <linux/export.h> 2025-06-16 09:06:19 +02:00
cfbfillrect.c fbdev: Include <linux/export.h> 2025-06-16 09:06:19 +02:00
cfbimgblt.c fbdev: Include <linux/export.h> 2025-06-16 09:06:19 +02:00
cfbmem.h fbdev: Refactoring the fbcon packed pixel drawing routines 2025-03-26 22:39:21 +01:00
fb_backlight.c backlight: Replace fb events with a dedicated function call 2025-04-10 10:39:03 +01:00
fb_chrdev.c fbdev: Do not export fbcon from fbdev 2026-06-09 16:00:11 +02:00
fb_cmdline.c fbdev: Fix logic error in "offb" name match 2025-10-10 00:31:13 +02:00
fb_copyarea.h fbdev: Refactoring the fbcon packed pixel drawing routines 2025-03-26 22:39:21 +01:00
fb_ddc.c fbdev: Include <linux/export.h> 2025-06-16 09:06:19 +02:00
fb_defio.c fbdev: defio: Remove duplicate include of linux/module.h 2026-04-28 14:18:51 +02:00
fb_draw.h fbdev: Refactoring the fbcon packed pixel drawing routines 2025-03-26 22:39:21 +01:00
fb_fillrect.h fbdev: core: Fix ubsan warning in pixel_to_pat 2025-09-30 23:21:34 +02:00
fb_imageblit.h fbdev: Refactoring the fbcon packed pixel drawing routines 2025-03-26 22:39:21 +01:00
fb_info.c fbdev: Track display blanking state 2025-04-10 10:38:57 +01:00
fb_internal.h fbdev: Wrap user-invoked calls to fb_blank() in helper 2026-06-09 16:00:10 +02:00
fb_io_fops.c fbdev: Include <linux/export.h> 2025-06-16 09:06:19 +02:00
fb_logo.c
fb_notify.c
fb_procfs.c
fb_sys_fops.c fbdev: Include <linux/export.h> 2025-06-16 09:06:19 +02:00
fbcmap.c fbdev: Include <linux/export.h> 2025-06-16 09:06:19 +02:00
fbcon_ccw.c fbcon: Put font-rotation state into separate struct 2026-04-07 17:38:07 +02:00
fbcon_cw.c fbcon: Put font-rotation state into separate struct 2026-04-07 17:38:07 +02:00
fbcon_rotate.c fbcon: Put font-rotation state into separate struct 2026-04-07 17:38:07 +02:00
fbcon_rotate.h lib/fonts: Implement glyph rotation 2026-04-07 17:38:07 +02:00
fbcon_ud.c fbcon: Put font-rotation state into separate struct 2026-04-07 17:38:07 +02:00
fbcon.c fbcon: fix NULL pointer dereference for a console without vc_data 2026-06-26 15:07:38 +02:00
fbcon.h fbdev: Do not export fbcon from fbdev 2026-06-09 16:00:11 +02:00
fbcvt.c fbdev: core: fbcvt: avoid division by 0 in fb_cvt_hperiod() 2025-05-31 10:24:02 +02:00
fbmem.c fbdev: Fix fb_new_modelist to prevent null-ptr-deref in fb_videomode_to_var 2026-06-26 15:12:45 +02:00
fbmon.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
fbsysfs.c fbdev: fix use-after-free in store_modes() 2026-06-26 14:56:13 +02:00
Kconfig fbdev: Turn FB_MODE_HELPERS into an internal config option 2025-09-23 15:56:04 +02:00
Makefile
modedb.c fbdev: modedb: Fix misaligned fields in the 1920x1080-60 mode 2026-06-12 23:23:43 +02:00
softcursor.c fbcon: Rename struct fbcon_ops to struct fbcon_par 2025-09-19 10:04:02 +02:00
svgalib.c fbdev fixes and cleanups for 6.17-rc1: 2025-08-02 09:58:11 -07:00
syscopyarea.c fbdev: Include <linux/export.h> 2025-06-16 09:06:19 +02:00
sysfillrect.c fbdev: Include <linux/export.h> 2025-06-16 09:06:19 +02:00
sysimgblt.c fbdev: Include <linux/export.h> 2025-06-16 09:06:19 +02:00
sysmem.h fbdev: Refactoring the fbcon packed pixel drawing routines 2025-03-26 22:39:21 +01:00
tileblit.c fbcon: Move fbcon callbacks into struct fbcon_bitops 2025-09-19 10:04:05 +02:00