Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] fbcon: out-of-bounds access in fbcon_prepare_logo() when logo fills screen --
commit adce6f78babc951d216d03dcfa386a57041815ee Author: Helge Deller <[email protected]> fbcon: Don't drop last logo line if logo is same size as screen This commit changes the upper bound on logo_lines in fbcon_prepare_logo() from new_rows - 1 to new_rows so that a full-screen boot logo does not have its last line clipped. > diff --git a/drivers/video/fbdev/core/fbcon.c > b/drivers/video/fbdev/core/fbcon.c > index d7890e119dc7d..2809c7a6893f9 100644 > --- a/drivers/video/fbdev/core/fbcon.c > +++ b/drivers/video/fbdev/core/fbcon.c > @@ -666,7 +666,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct > fb_info *info, > 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); > + logo_lines = min(logo_lines, new_rows); > if (logo_lines <= 0) { > logo_lines = 0; > logo_shown = FBCON_LOGO_DONTSHOW; [Severity: High] Can allowing logo_lines to equal new_rows cause an out-of-bounds read past vc->vc_screenbuf and leave the VT scrolling region empty? When logo_lines == new_rows, it equals vc->vc_bottom (vc->vc_rows), so the end of fbcon_prepare_logo() sets vc->vc_top = vc->vc_bottom: drivers/video/fbdev/core/fbcon.c:fbcon_prepare_logo() { ... if (logo_lines > vc->vc_bottom) { logo_shown = FBCON_LOGO_CANSHOW; pr_info("fbcon: disable boot-logo (boot-logo bigger than screen).\n"); } else { logo_shown = FBCON_LOGO_DRAW; vc->vc_top = logo_lines; } } In fbcon_switch(), the FBCON_LOGO_DRAW path then calls update_region() with start = vc->vc_origin + vc->vc_size_row * vc->vc_top (which is vc->vc_scr_end, one u16 past vc->vc_screenbuf) and count = 0. do_update_region() reads scr_readw(p) before checking whether count is zero, causing a 2-byte slab-out-of-bounds read past vc->vc_screenbuf: drivers/tty/vt/vt.c:do_update_region() { ... for(;;) { u16 attrib = scr_readw(p) & 0xff00; int startx = xx; u16 *q = p; while (xx < vc->vc_cols && count) { ... } Having vc->vc_top == vc->vc_bottom == vc->vc_rows also leaves an empty scrolling region: con_scroll() returns early on top >= bottom without scrolling or resetting vc->vc_top to 0, and if DEC Origin Mode (vc->vc_decom) is enabled, gotoxy() clamps new_y < min_y to vc->state.y = vc->vc_rows, placing vc->vc_pos at or past vc->vc_scr_end for subsequent console reads and writes. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
