mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Zou Jianqiang <jq.zou@outlook.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"byu@xidian.edu.cn" <byu@xidian.edu.cn>,
	"25181214217@stu.xidian.edu.cn" <25181214217@stu.xidian.edu.cn>,
	ONE Zeroiser <zeroisere@outlook.com>
Subject: Re: [PATCH] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var()
Date: Wed, 18 Nov 2026 20:19:15 +0100	[thread overview]
Message-ID: <633ab4d8-fb7f-435b-9052-fd0a51bfb47f@gmx.de> (raw)
In-Reply-To: <20261101104107.33909-1-jq.zou@outlook.com>

On 11/1/26 11:41, Zou Jianqiang 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>
> ---
>   drivers/video/fbdev/aty/radeon_base.c | 3 +++
>   1 file changed, 3 insertions(+)
applied.

Thanks!
Helge

      parent reply	other threads:[~2026-11-18 19:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-01 10:41 Zou Jianqiang
2026-11-11 14:39 ` Jianqiang Zou
2026-11-18 19:19 ` Helge Deller [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=633ab4d8-fb7f-435b-9052-fd0a51bfb47f@gmx.de \
    --to=deller@gmx.de \
    --cc=25181214217@stu.xidian.edu.cn \
    --cc=benh@kernel.crashing.org \
    --cc=byu@xidian.edu.cn \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jq.zou@outlook.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zeroisere@outlook.com \
    /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

all inboxes | Powered by JetHome®