* [PATCH 1/2] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var()
@ 2026-11-20 17:54 Helge Deller
2026-11-20 17:54 ` [PATCH 2/2] fbcon: Don't drop last logo line if logo is same size as screen Helge Deller
2026-11-23 7:52 ` [PATCH 1/2] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var() Geert Uytterhoeven
0 siblings, 2 replies; 4+ messages in thread
From: Helge Deller @ 2026-11-20 17:54 UTC (permalink / raw)
To: linux-fbdev, dri-devel; +Cc: Jianqiang Zou, stable
From: Jianqiang Zou <jq.zou@outlook.com>
radeonfb_set_par() derives the dot clock from the user supplied
struct fb_var_screeninfo:
dotClock = 1000000000 / pixClock;
where pixClock is copied from mode->pixclock. A zero pixclock
bypasses the existing validation and makes the kernel divide by zero
in radeonfb_set_par().
The driver does have a check for this: fb_validate_mode() returns
-EINVAL when pixclock is 0, but radeon_match_mode() only calls it when
the output has no scaler and an EDID-derived mode database is
available:
if (has_rmx == 0 && rinfo->mon1_modedb)
if (fb_validate_mode(...))
return -EINVAL;
mon1_modedb is only filled in when an EDID is read, so when no
EDID-derived mode database is available the validation is skipped and
the invalid mode reaches radeonfb_set_par().
Reject a zero pixclock in radeonfb_check_var() before matching the
mode. fb_set_var() calls it on the FBIOPUT_VSCREENINFO path before
->fb_set_par(), so the invalid value is rejected before the mode is
applied. This is the same check other fbdev drivers use (i740fb,
arkfb, s3fb).
Reproduced on Linux 7.3.0 using a custom QEMU PCI stub device with
vendor/device ID 1002:5955; no physical Radeon hardware was used. A
single FBIOPUT_VSCREENINFO with pixclock = 0 is enough to trigger the
divide error.
Signed-off-by: Jianqiang Zou <jq.zou@outlook.com>
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
---
drivers/video/fbdev/aty/radeon_base.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c
index 387bc5f96765..45dd42134e81 100644
--- a/drivers/video/fbdev/aty/radeon_base.c
+++ b/drivers/video/fbdev/aty/radeon_base.c
@@ -836,6 +836,9 @@ static int radeonfb_check_var (struct fb_var_screeninfo *var, struct fb_info *in
int nom, den;
unsigned int pitch;
+ if (!var->pixclock)
+ return -EINVAL;
+
if (radeon_match_mode(rinfo, &v, var))
return -EINVAL;
--
2.56.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] fbcon: Don't drop last logo line if logo is same size as screen
2026-11-20 17:54 [PATCH 1/2] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var() Helge Deller
@ 2026-11-20 17:54 ` Helge Deller
2026-11-23 7:52 ` [PATCH 1/2] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var() Geert Uytterhoeven
1 sibling, 0 replies; 4+ messages in thread
From: Helge Deller @ 2026-11-20 17:54 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.
This patch fixes this off-by-one bug, but now -as sashiko-bot noticed-
since the logo covers the whole screen there is no area left in which
the text can be scrolled. To avoid accesses outside the screen memory
simply keep the text area covering the full screen (and possibly
overwriting) the full-screen logo.
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 | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index d7890e119dc7..cc311dc0e2e4 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;
@@ -734,7 +734,9 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
pr_info("fbcon: disable boot-logo (boot-logo bigger than screen).\n");
} else {
logo_shown = FBCON_LOGO_DRAW;
- vc->vc_top = logo_lines;
+ /* keep vc_top if logo covers whole screen */
+ if (logo_lines < vc->vc_bottom)
+ vc->vc_top = logo_lines;
}
}
#endif /* MODULE */
--
2.56.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var()
2026-11-20 17:54 [PATCH 1/2] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var() Helge Deller
2026-11-20 17:54 ` [PATCH 2/2] fbcon: Don't drop last logo line if logo is same size as screen Helge Deller
@ 2026-11-23 7:52 ` Geert Uytterhoeven
2026-11-23 16:09 ` Helge Deller
1 sibling, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2026-11-23 7:52 UTC (permalink / raw)
To: Helge Deller; +Cc: linux-fbdev, dri-devel, Jianqiang Zou, stable
Hi Helge, Jianqiang,
On Fri, 20 Nov 2026 at 18:54, Helge Deller <deller@gmx.de> wrote:
> From: Jianqiang Zou <jq.zou@outlook.com>
>
> radeonfb_set_par() derives the dot clock from the user supplied
> struct fb_var_screeninfo:
>
> dotClock = 1000000000 / pixClock;
>
> where pixClock is copied from mode->pixclock. A zero pixclock
> bypasses the existing validation and makes the kernel divide by zero
> in radeonfb_set_par().
>
> The driver does have a check for this: fb_validate_mode() returns
> -EINVAL when pixclock is 0, but radeon_match_mode() only calls it when
> the output has no scaler and an EDID-derived mode database is
> available:
>
> if (has_rmx == 0 && rinfo->mon1_modedb)
> if (fb_validate_mode(...))
> return -EINVAL;
>
> mon1_modedb is only filled in when an EDID is read, so when no
> EDID-derived mode database is available the validation is skipped and
> the invalid mode reaches radeonfb_set_par().
>
> Reject a zero pixclock in radeonfb_check_var() before matching the
> mode. fb_set_var() calls it on the FBIOPUT_VSCREENINFO path before
> ->fb_set_par(), so the invalid value is rejected before the mode is
> applied. This is the same check other fbdev drivers use (i740fb,
> arkfb, s3fb).
>
> Reproduced on Linux 7.3.0 using a custom QEMU PCI stub device with
> vendor/device ID 1002:5955; no physical Radeon hardware was used. A
> single FBIOPUT_VSCREENINFO with pixclock = 0 is enough to trigger the
> divide error.
>
> Signed-off-by: Jianqiang Zou <jq.zou@outlook.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Helge Deller <deller@gmx.de>
Thanks for your patch, which is now commit b3f1631d362539cf ("fbdev:
radeonfb: reject a zero pixclock in radeonfb_check_var()") in v7.4-rc4.
> --- a/drivers/video/fbdev/aty/radeon_base.c
> +++ b/drivers/video/fbdev/aty/radeon_base.c
> @@ -836,6 +836,9 @@ static int radeonfb_check_var (struct fb_var_screeninfo *var, struct fb_info *in
> int nom, den;
> unsigned int pitch;
>
> + if (!var->pixclock)
> + return -EINVAL;
> +
This violates fbdev API rounding rules:
1. If a value doesn't fit, it must be rounded up by the driver,
2. If a value is too large, -EINVAL must be returned.
> if (radeon_match_mode(rinfo, &v, var))
> return -EINVAL;
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var()
2026-11-23 7:52 ` [PATCH 1/2] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var() Geert Uytterhoeven
@ 2026-11-23 16:09 ` Helge Deller
0 siblings, 0 replies; 4+ messages in thread
From: Helge Deller @ 2026-11-23 16:09 UTC (permalink / raw)
To: Geert Uytterhoeven, Jianqiang Zou; +Cc: linux-fbdev, dri-devel
On 11/23/26 08:52, Geert Uytterhoeven wrote:
> Hi Helge, Jianqiang,
>
> On Fri, 20 Nov 2026 at 18:54, Helge Deller <deller@gmx.de> wrote:
>> From: Jianqiang Zou <jq.zou@outlook.com>
>>
>> radeonfb_set_par() derives the dot clock from the user supplied
>> struct fb_var_screeninfo:
>>
>> dotClock = 1000000000 / pixClock;
>>
>> where pixClock is copied from mode->pixclock. A zero pixclock
>> bypasses the existing validation and makes the kernel divide by zero
>> in radeonfb_set_par().
>>
>> The driver does have a check for this: fb_validate_mode() returns
>> -EINVAL when pixclock is 0, but radeon_match_mode() only calls it when
>> the output has no scaler and an EDID-derived mode database is
>> available:
>>
>> if (has_rmx == 0 && rinfo->mon1_modedb)
>> if (fb_validate_mode(...))
>> return -EINVAL;
>>
>> mon1_modedb is only filled in when an EDID is read, so when no
>> EDID-derived mode database is available the validation is skipped and
>> the invalid mode reaches radeonfb_set_par().
>>
>> Reject a zero pixclock in radeonfb_check_var() before matching the
>> mode. fb_set_var() calls it on the FBIOPUT_VSCREENINFO path before
>> ->fb_set_par(), so the invalid value is rejected before the mode is
>> applied. This is the same check other fbdev drivers use (i740fb,
>> arkfb, s3fb).
>>
>> Reproduced on Linux 7.3.0 using a custom QEMU PCI stub device with
>> vendor/device ID 1002:5955; no physical Radeon hardware was used. A
>> single FBIOPUT_VSCREENINFO with pixclock = 0 is enough to trigger the
>> divide error.
>>
>> Signed-off-by: Jianqiang Zou <jq.zou@outlook.com>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Helge Deller <deller@gmx.de>
>
> Thanks for your patch, which is now commit b3f1631d362539cf ("fbdev:
> radeonfb: reject a zero pixclock in radeonfb_check_var()") in v7.4-rc4.
>
>
>> --- a/drivers/video/fbdev/aty/radeon_base.c
>> +++ b/drivers/video/fbdev/aty/radeon_base.c
>> @@ -836,6 +836,9 @@ static int radeonfb_check_var (struct fb_var_screeninfo *var, struct fb_info *in
>> int nom, den;
>> unsigned int pitch;
>>
>> + if (!var->pixclock)
>> + return -EINVAL;
>> +
>
> This violates fbdev API rounding rules:
> 1. If a value doesn't fit, it must be rounded up by the driver,
> 2. If a value is too large, -EINVAL must be returned.
>
>> if (radeon_match_mode(rinfo, &v, var))
>> return -EINVAL;
Oops... you are right!
Jianqiang Zou, will you send another patch fixing this?
Helge
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-23 16:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 17:54 [PATCH 1/2] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var() Helge Deller
2026-11-20 17:54 ` [PATCH 2/2] fbcon: Don't drop last logo line if logo is same size as screen Helge Deller
2026-11-23 7:52 ` [PATCH 1/2] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var() Geert Uytterhoeven
2026-11-23 16:09 ` Helge Deller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox