FAILED: patch "[PATCH] drm/amdgpu: fix tear down order in amdgpu_vm_pt_free" failed to apply to 6.7-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.7-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.7.y
git checkout FETCH_HEAD
git cherry-pick -x 683b8c7e7a94fb7445b8d300c7404322ad040bab
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024012701-seventh-excluding-8ef8@gregkh' --subject-prefix 'PATCH 6.7.y' HEAD^..
Possible dependencies:
683b8c7e7a94 ("drm/amdgpu: fix tear down order in amdgpu_vm_pt_free")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 683b8c7e7a94fb7445b8d300c7404322ad040bab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <[email protected]>
Date: Fri, 8 Dec 2023 13:43:09 +0100
Subject: [PATCH] drm/amdgpu: fix tear down order in amdgpu_vm_pt_free
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When freeing PD/PT with shadows it can happen that the shadow destruction races with detaching the PD/PT from the VM causing a NULL pointer dereference in the invalidation code.
Fix this by detaching the the PD/PT from the VM first and then freeing the shadow instead.
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +2 -1
@@ -642,13 +642,14 @@ static void amdgpu_vm_pt_free(struct amdgpu_vm_bo_base *entry)if (!entry->bo)return ; + + entry->bo->vm_bo =NULL ; shadow =amdgpu_bo_shadowed (entry->bo);if (shadow) {ttm_bo_set_bulk_move (&shadow->tbo,NULL );amdgpu_bo_unref (&shadow); }ttm_bo_set_bulk_move (&entry->bo->tbo,NULL ); - entry->bo->vm_bo =NULL ;spin_lock (&entry->vm->status_lock);list_del (&entry->vm_status);