All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fbcon: Don't drop last logo line if logo is same size as screen
@ 2026-11-19 12:49 Helge Deller
  2026-11-19 13:04 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Helge Deller @ 2026-11-19 12:49 UTC (permalink / raw)
  To: linux-fbdev, dri-devel; +Cc: Henri Roosen, stable

Henri reported a regression that when a custom bootlogo is exactly as
big as the screen, a white bar with the size of the font height is
displayed at the bottom of the display.  Fix this off-by-one bug.

Fixes: 94e6a058b168 ("fbcon: Fix KASAN slab-out-of-bounds Read in fbcon_prepare_logo")
Tested-by: Henri Roosen <henri.roosen@ginzinger.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org # v7.3+
---
 drivers/video/fbdev/core/fbcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index d7890e119dc7..2809c7a6893f 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;
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fbcon: Don't drop last logo line if logo is same size as screen
  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
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-19 13:04 UTC (permalink / raw)
  To: Helge Deller, dri-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-19 13:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.