fbcon: Fix KASAN slab-out-of-bounds Read in fbcon_prepare_logo

Ensure the logo will not exceed the screen size, which then should
fix a reported KASAN: slab-out-of-bounds Read in fbcon_prepare_logo.

Reported-by: syzbot+0c815b25cdb3678e7083@syzkaller.appspotmail.com
Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
Helge Deller 2026-08-22 12:03:15 +02:00
parent 72e91bba11
commit 94e6a058b1

View File

@ -660,6 +660,13 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
erase &= ~0x400;
logo_height = fb_prepare_logo(info, par->rotate);
logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height);
logo_lines = min(logo_lines, rows);
logo_lines = min(logo_lines, new_rows - 1);
if (logo_lines <= 0) {
logo_lines = 0;
logo_shown = FBCON_LOGO_DONTSHOW;
return;
}
q = (unsigned short *) (vc->vc_origin +
vc->vc_size_row * rows);
step = logo_lines * cols;