From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380891; b=SW90VsnDZIqIN8XyZa9hYiXGhcQCtCAOePpzqcVWzpHbSEo8lM5ln7o5ylRBHUPIXxQv jPGpiCD70WhrMTrKl7Iqvztw8gj6KBNdsd1pCFRXFVPKaQFXqRC6RWBiEdIhBXeJwkDJP HkCcm7HD/UFTmdxL/3QMmtyRh60bd6gZ2QWoWaZ/0nqHEdntjlH0KOH6PYdpIIDGBCdwx pgC+9fFPfoal6Phjx5fM7wdhQlNDVPL5gk72XNdiElWs1gQaaOHd6zMdQpIt/ljV44Fmo UTMuT1VXxzzV7oOQlB9DHMBWS417OuhJXQJ/0+z/JCpXMrXMPNACGzGnBIYKEfcnouw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380891; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=alRcYIS6aYKGur2pMOh8UPClCMz5VuB69e4NHAFIumM=; b=qDzpsVslN5wbh3LNEJVy3T9+YGk4xZnOgpA5D1ODDmnupNmc/cti4+8KwMTdwdN05PTn kdZRBtcTL4d7RQ3MDr38DIV134QVOxAnSWu39mxkChcl34IdqYXXXnfgR/5gXY9f44gtn JjRKl5Jp/F62lh7OGb41algv3MJqT7Q3x2+jPuEfdPKNGO9GhOGgi2A7lSn/dpXZVYYUg uojLbJHdV1T9sQJ4vTvMzzWXhroTTerMEhQmB8C8CieAdg2mqQJuwzMbVlFZWPqnGkztq hr/TQvyydScM7/B9wUPoXdXgueV1DFEK/9LaHocvdryyoKCAFAqKInJ1yk+4eXEJ/3Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=vl04AhP4; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA796606A322; Fri, 4 Dec 2026 10:41:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=vl04AhP4 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F9061F000CE; Fri, 4 Dec 2026 10:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380890; bh=alRcYIS6aYKGur2pMOh8UPClCMz5VuB69e4NHAFIumM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vl04AhP4bEHqpAD4xPFeBdx7fmXc9DdKE3g77sK41eySKvqJOnrZ8ySSEXxPov60a N3ffwOw8cJjDcIJqoS7n9oCD63+0jgkPeWKn6DlpzjlH4qHBviZIhT+DcdQfU4DLPo Bu5WgwEYDw/5ePICncvYV969mlVOuO/zjkv1KrxM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jianqiang Zou , Helge Deller Subject: [PATCH 7.3 468/742] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var() Date: Fri, 4 Dec 2026 19:05:32 +0900 Message-ID: <20261204100647.587867983@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jianqiang Zou commit b3f1631d362539cfe14571ccfd7db919ffbc08c7 upstream. 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 Cc: stable@vger.kernel.org Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/aty/radeon_base.c | 3 +++ 1 file changed, 3 insertions(+) --- 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 int nom, den; unsigned int pitch; + if (!var->pixclock) + return -EINVAL; + if (radeon_match_mode(rinfo, &v, var)) return -EINVAL;