From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 9B888341AC7; Sat, 30 May 2026 17:56:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780163812; cv=none; b=IxajxYt81/pFLtI6eLBOjPm9oTyO/Yix7PVWJfGVHkPnU9TwQRk0ztPzn+3mB4XMketSJIiWZ6u2yZXE5wWjxLkqiGeujh7j7udJ42qU3Hu1OsjKd3FsxglMB0Gk8JZcul+2wrzr+ShY19js4xE7Khao9oP22UEYwZsDMUD7UO4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780163812; c=relaxed/simple; bh=GBUlrMgpF7kSB1kYcDq1+GkwWY/bKB6CKjhokPFnSC0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eOnesjxEJjDFlrpBybToW0R2JX9MVRVPXcG2GXtffZ+FugcT5O0Ztx6Szp5yvPMqoivbXfc63vkggK9BxFfcFAj1O3QUfO8VopXz2gIoEECh5kvaOb5ME1b5rADZMDJz0mS2j+CgLtSTwHS50Fy0+FDpGdzDhS852VzsxMPJM2s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qD4r0qSQ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="qD4r0qSQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D81CE1F00893; Sat, 30 May 2026 17:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780163811; bh=pq+RmI7bbUZXsXH7g32yrGuwZmW8CsY0Varq/aV53PA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qD4r0qSQ2fJyLfPCzFgYGlC8f5dvYy6+e39ICe1WQMVLu2TEjLH7jHs5JlaBMTffo X8fyJ+Aw6+tPgc2WEnwcAI28JpIjt8Qp0ekR0FhXu3l/2SNr+xPIUVVmY7VWE9B+UG Kcqa8XjAcsLQSHCeMSWFeHwOAcD0ZZn5/Db1K+zI= 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 5.15 370/776] drm/amdgpu/sdma4: replace BUG_ON with WARN_ON in fence emission Date: Sat, 30 May 2026 18:01:24 +0200 Message-ID: <20260530160250.110041341@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160240.228940103@linuxfoundation.org> References: <20260530160240.228940103@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.15-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 @@ -955,7 +955,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)); @@ -965,7 +965,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));