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=1796384233; b=VdZz9cj8V1T6asxsWRJh2IAKH0DNCzqpmIsTkBA6FZSgvIbHREepe2n1hHmgxBW4GErk jFWffpOpsD3EI66hjKMc8MK74BvOKgC9bxbQCus8sgtNVB2IUpTQzeK5AJsANCwl1NQ8c Y3mDxHMUJ73ERqgm1Izg/VDbzwk/y0Uuenxn7RXjcOyBpjqCWgoRHn4LSPMolBcZUSysF wfpNNGWHZ34EPtk/xcQBncNXy43yIOj0mw43FI0h7u9lTJIW/6zYJRQ+Vxrztpwi8ma7R XfB2qpYQGtmOR6n45MoSbtgLbEXNy1JRhM7V/lNbxUv4zr3XLVnActFaM4dJxaNc1Gg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384233; 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=Sm/aQK3v1P85oERXnfXoUixgFm5u4IjyWONjpf+nfbk=; b=GeneVdbub5KdksQUK49YkDTt1OjzE5KjETeKXHUltLVMqdxLxV0ec1qLJbmshnJ/tLj9 qtT9k5/xKKU7cyl/2lP8wZOw3R+Cu6eehfLXjpjQtZTE9GKXViR96aE5Dbtvm3UjHfDON i2cf3BtOkgFXBn5t0dTBMc+rPrFrPJtHIqNDPrCt5iIt7YdGvNHVrS0K/Vj223dSIzISv X+0qHhXlDSP5BqtIPRO8W+uzZ29Ld6nRFrwrpfzM1h/L4iB4lqQLz4o+s/Gs+4E518WUj sSO47PdDbbPJkoQPcw1u9S8fPWS/8sGVUdVSrPDZ26gBQV72IYQQHD6F2bOaTo6WFBQ== 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=rF7wsmcl; 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 541B8606A32C; Fri, 4 Dec 2026 11:37:13 +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=rF7wsmcl Received: by smtp.kernel.org (Postfix) with ESMTPSA id C038A1F000CE; Fri, 4 Dec 2026 11:37:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384233; bh=Sm/aQK3v1P85oERXnfXoUixgFm5u4IjyWONjpf+nfbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rF7wsmclU4AEy3S7X6a27oAGJx5udyVvXnw7g+muqITWqHepyaVhCIg+6qb9Immdx alzUbqWZsV7iwkafeO/QAZPpSdFfyoKkzfFkVn3UVmhbJPpno+5WurD1lqljPtgP6Y sqfNzpO4U17FnYy6Kydt65Mzoa7nLN68cy0Vksfo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Thomas Zimmermann , Ruben Wauters Subject: [PATCH 6.12 554/555] drm/gud: fix potential divide error due to optimisation Date: Fri, 4 Dec 2026 19:09:57 +0900 Message-ID: <20261204100629.618205635@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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.12-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 @@ -343,7 +343,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;