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=1796382361; b=khzALw96pTdA7irHH2rsdPjdBpIiuzg7CHdVEIj1XICNk4Em/yWPMWXM4d4AAOhWB+wv KyGfEB76njn2LsQwLaLa3BiqWsjSGYo1vVkGNbvOxM02prqhKtQMZVmIl6IQlmwwLJdYn ZAh12PNq6HoR9+H1/E1tvb5BmYRlI8bjaffcjftHlb79N4QFmtra7bS6NuswmvDLcm637 tZx2YjWDDv6yKXLdzxU9Mj1SkSDGrNErWYIIiaU42OfKWAoS2S7CiCem5K02pIEreJoD8 +bkU1L3erQ4dRRjs9k2GNZSdCaqdbZBlrDXamxOdcxsK6pdhNHpOfGK8B5KiB34039A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382361; 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=oxygXi6tI9ka5LZ36YM2v5vduaIwWUxN0zRg81K7dK4=; b=c3EjAFRYUexIqR4VmdGRmvqSBJASnmD57JwI+y8ALj+AGYm7xefOevcU5w3YXhqyt3hi YgrLsY8girdwNuazIUt+z0Z8g/GwAQjyMI7XTqJeVQP5nLamyD9kISyoePAJ5kolJrxPc HBPEtdp2p3tedFrR8Tyujf/Lozm44qcjPrBbv+A7qm1hijAwqnS5YeHB0lIPaMg+r9R0e V+eXcF9pb/PMMiHoam0dg9H9QDVj6II7npvbJImz9PTY4EzXqECuxXMgCFitlCF9T7rWg aTIhzGQe/sHTSgYjEowKfH+tDXAo1sQAhyJzNVCdhs8RKtZrNFzGM/7sEFAx92467pw== 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=oe4bkt4E; 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 5C5EC606A32C; Fri, 4 Dec 2026 11:06:01 +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=oe4bkt4E Received: by smtp.kernel.org (Postfix) with ESMTPSA id C01831F000C2; Fri, 4 Dec 2026 11:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382361; bh=oxygXi6tI9ka5LZ36YM2v5vduaIwWUxN0zRg81K7dK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oe4bkt4EoS38n+JLgKt4BJz59u9CmgF+zBL/OG3jWiQmz5F8vO+IfHexqYDRnp+oW wyC4uKZ15I1MDY46C+436rPQA1+p6Cz5+AdRb7KGmpQxmNt+1+c8/Pj8WvdVQREZsN YiG3Wa4Vp13vmEiM0BACdXPzOD285oR/uKQJFKRk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jianqiang Zou , Helge Deller Subject: [PATCH 6.18 421/703] fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var() Date: Fri, 4 Dec 2026 19:05:20 +0900 Message-ID: <20261204100639.025642443@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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 6.18-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;