diff options
| author | Yao Yiqi <yaoyiqi3@huawei.com> | 2026-10-19 17:43:30 +0800 |
|---|---|---|
| committer | Helge Deller <deller@gmx.de> | 2026-10-20 22:29:20 +0200 |
| commit | e4b6b865d45d8dafb6c6f28c8a993a5b4431d25a (patch) | |
| tree | ae610c02032fb5466b779c49dfabb18781a6f0c5 /include/linux | |
| parent | 10463bcd43495fb88ff667b2c5348200860f6bdc (diff) | |
fbcon: Rebuild rotated font buffer on font change
fbcon_rotate_font() caches a rotated copy of the console font in
par->rotated.buf. The buffer is sized from the font's width, height
and charcount, and is rebuilt in fbcon_init(), fbcon_switch() and
fbcon_modechanged(), but not in fbcon_do_set_font().
When the font is changed through KDFONTOP, the new geometry is
installed and vc_resize() redraws before the buffer is rebuilt. The
rotated putcs/cursor ops then index the old buffer with the new cell
size; KASAN reports a slab-out-of-bounds read in soft_cursor().
Rebuild the buffer for the visible console before the redraw, as the
other callers do: select the console's blitting state with
set_blitting_type() (which also uploads the new font's map on
tile-blitting hardware), then rebuild. Background consoles keep
their rebuild at fbcon_switch() time, as the buffer is shared per
framebuffer and must not be updated for a console that is not being
displayed.
To ensure a correct rollback when the rebuild or the following
vc_resize() fails, save the rotated font state, clear it before
rebuilding, and restore it in the error path of
fbcon_do_set_font().
Fixes: 6cc50e1c5b57 ("[PATCH] fbcon: Console Rotation - Add support to rotate font bitmap")
Cc: stable@vger.kernel.org
Signed-off-by: Yao Yiqi <yaoyiqi3@huawei.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
