dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Helge Deller" <deller@gmx.de>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] fbcon: Don't drop last logo line if logo is same size as screen
Date: Thu, 19 Nov 2026 13:04:48 +0000	[thread overview]
Message-ID: <sashiko-outbox-223135@kernel.org> (raw)
In-Reply-To: <20261119124944.98882-1-deller@gmx.de>

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 <deller@gmx.de>

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/20261119124944.98882-1-deller@gmx.de?part=1

      reply	other threads:[~2026-11-19 13:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 12:49 [PATCH] fbcon: Don't drop last logo line if logo is same size as screen Helge Deller
2026-11-19 13:04 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-223135@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox