From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28B7A3E0091; Fri, 15 May 2026 16:11:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778861496; cv=none; b=q+EHwa89PTQLLRqz/Cdj58TEM+lKz82j2BalxB2420FyMEAUCW7Vlgs1zcl8mS3VeV02SUQnFTr+6vRaqgdtwmds2VozpD0fcQDuBWcGT/AR4Sw36/PMaOIdr+PHrnhIldBongZFCu4eskdYmQTueXviICb3tVWlyjnjYL6Gzhk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778861496; c=relaxed/simple; bh=TU6Erz1HWrZRP/NylZUwR9AtMEDrzC7Ag7ARZgerVCk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Mj7Y/bjc7HcpQK0Dd7jVAE+7jHPBi9zrLW0C0RJyaxgeWZpJf2bglDw7U3tfanch0LNpDxllruIcKwI2sDkIsW7+PtbsM0luFOGqWFvH/pYnMA0myBfqhZgnFSfFkysyYKoWu+623BIrLkw/Hwe9tbh8m+8S3OGMi5fQ0+QGaJQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=bC/t6rr4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="bC/t6rr4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B33D3C2BCB0; Fri, 15 May 2026 16:11:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778861496; bh=TU6Erz1HWrZRP/NylZUwR9AtMEDrzC7Ag7ARZgerVCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bC/t6rr4fFMIdqg0P8rdI+VK3slRHrxUB547CSWB4ZAhuYOtI5wovUGSi6VHjELEP 7dMhPkhzM7i5S6x3/vIwrHqNhFEWQmAUUMy1W68JWwGka2p0KVKmCsrAXyDukXJQx3 Dtjsc6ITYDpjsgeP26NynpHHkoKUaRtTrpg498Bk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Christian=20K=C3=B6nig?= , "John B. Moore" , Alex Deucher Subject: [PATCH 6.6 352/474] drm/amdgpu/sdma4: replace BUG_ON with WARN_ON in fence emission Date: Fri, 15 May 2026 17:47:41 +0200 Message-ID: <20260515154722.632931573@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260515154715.053014143@linuxfoundation.org> References: <20260515154715.053014143@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: John B. Moore commit 78d2e624fa073c14970aa097adcf3ea31c157a66 upstream. sdma_v4_0_ring_emit_fence() contains two BUG_ON(addr & 0x3) assertions that verify fence writeback addresses are dword-aligned. These assertions can be reached from unprivileged userspace via crafted DRM_IOCTL_AMDGPU_CS submissions, causing a fatal kernel panic in a scheduler worker thread. Replace both BUG_ON() calls with WARN_ON() to log the condition without crashing the kernel. A misaligned fence address at this point indicates a driver bug, but crashing the kernel is never the correct response when the assertion is reachable from userspace. The CS IOCTL path is the correct place to filter invalid submissions; the ring emission callback is too late to do anything about it. Fixes: 2130f89ced2c ("drm/amdgpu: add SDMA v4.0 implementation (v2)") Reviewed-by: Christian König Signed-off-by: John B. Moore Signed-off-by: Alex Deucher (cherry picked from commit b90250bd933afd1ba94d86d6b13821997b22b18e) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c @@ -841,7 +841,7 @@ static void sdma_v4_0_ring_emit_fence(st /* write the fence */ amdgpu_ring_write(ring, SDMA_PKT_HEADER_OP(SDMA_OP_FENCE)); /* zero in first two bits */ - BUG_ON(addr & 0x3); + WARN_ON(addr & 0x3); amdgpu_ring_write(ring, lower_32_bits(addr)); amdgpu_ring_write(ring, upper_32_bits(addr)); amdgpu_ring_write(ring, lower_32_bits(seq)); @@ -851,7 +851,7 @@ static void sdma_v4_0_ring_emit_fence(st addr += 4; amdgpu_ring_write(ring, SDMA_PKT_HEADER_OP(SDMA_OP_FENCE)); /* zero in first two bits */ - BUG_ON(addr & 0x3); + WARN_ON(addr & 0x3); amdgpu_ring_write(ring, lower_32_bits(addr)); amdgpu_ring_write(ring, upper_32_bits(addr)); amdgpu_ring_write(ring, upper_32_bits(seq));