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=1796381527; b=isHlcczI4JXAS9vJuhV9DiTuPi8vT4kJbYwMfjKp+3SOc9MctjF0Yf9hOQjTnUPKh8xk /yai6qL4tn4eJ3VJoy69VuaPVx5Eolr2+fQcG0C7YUr2mnV1SpsdcZgNh3tlthXH2Pdf1 cAqwVB0ISB0V1uyo3fkpzwyTztvZHlacPEEhzc/gzxbxpRlkcBqRdC2Lh7Y4mwYMFYcsS QZBEBtzOGE/gVxQ6A2fDtmZbMbrVchxqbJmPpO1gR3W7YRrGJ4zi8UiTe6Y8WzjH3DlN8 z7pzs2E8YXCL0Mo8Ct3Cvxga2CcYdfDOe1DW+X7TstOkJLoI715eCYUPSwjDg4Il9Pw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381527; 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=oBhARyNohnPm4yQhuZnu7U8hcCVSDdYOV0AY5FyRQ8Q=; b=E47kpcaEXD3WElKnvDIDs3cLZc/Pf/cWJJUJi++GZ+lnnKAPBHcYmLBcbG1XYVwHkL3l LnC/VEubv6Zw9BAGpZhQZ4FRHXDxHMLBTCqGqIJNeMGBvjTTtUJftY2FJDNtJddlCJ5+S pSjScfqYhdLVOG+OAMIxXUeDztm0Fp9SN2Uw2VpnnjOZVLiQ+SReyE2hOn9tN+kF8Mp2c ZyckwX5iH3oIF99o68vN1VWf48b28IZXFbnZgxSkrg81/GrLRi9BQSwd3bK1dP97vma4L 3rFfzEa+0tykZ1/WiANJvhTc3ANgJ9flDissGIXj1q5x7LHbCveo/1emBEFYh/6Y3xA== 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=tIuxi8fL; 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 B6E86606A682; Fri, 4 Dec 2026 10:52:07 +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=tIuxi8fL Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FAF01F000C2; Fri, 4 Dec 2026 10:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381527; bh=oBhARyNohnPm4yQhuZnu7U8hcCVSDdYOV0AY5FyRQ8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=tIuxi8fLY+eE0DINqeZDtiXEhhR5OG1LYL6DjuOuTxBFEKtgwmM9ys0jBwqcMKvOb 0vmjVyIECtw3TEr1rZuhjstQ0S33Th5BlodpnclDtwoHm3xeNJQIiuRNPH7IiS7h9m b2uLRY8jAf7VWCp47F3uA/b7p1WtbMC1GV2XlSc4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Thomas Zimmermann , Ruben Wauters Subject: [PATCH 7.3 741/742] drm/gud: fix potential divide error due to optimisation Date: Fri, 4 Dec 2026 19:10:05 +0900 Message-ID: <20261204100654.801560130@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: Ruben Wauters commit cbea6bdc930b2de974e77e6c3031f67796793625 upstream. Compilers can potentially optmise the read of gdrm->stats_actual_length to two separate reads. As flagged by sashiko, when the rect is flushed the stats_actual_length can reset to zero. If this was to occur between the two reads, the divide error can still be triggered (albeit rarely). Fix this by adding a READ_ONCE around the gdrm->stats_actual_length Fixes: 431c2dffd2b7 ("drm/gud: avoid divide error in gud_stats_debugfs") Cc: Reviewed-by: Thomas Zimmermann Link: https://patch.msgid.link/20261117141943.10540-1-ruben.wauters@linux.dev Signed-off-by: Ruben Wauters Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/gud/gud_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/gud/gud_drv.c +++ b/drivers/gpu/drm/gud/gud_drv.c @@ -329,7 +329,7 @@ static int gud_stats_debugfs(struct seq_ seq_puts(m, "\n"); if (gdrm->compression) { - u64 actual_length = gdrm->stats_actual_length; + u64 actual_length = READ_ONCE(gdrm->stats_actual_length); u64 remainder; u64 ratio, ratio_frac;