Skip to contentSkip to conversation

FAILED: patch "[PATCH] drm/ttm: Avoid NULL pointer deref for evicted BOs" failed to apply to 5.10-stable tree

PATCH [email protected] 1 participant 1 message Jan 5

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.10-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-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 491adc6a0f9903c32b05f284df1148de39e8e644
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026010549-periscope-recluse-8408@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 491adc6a0f9903c32b05f284df1148de39e8e644 Mon Sep 17 00:00:00 2001
From: Simon Richter <[email protected]>
Date: Tue, 14 Oct 2025 01:11:33 +0900
Subject: [PATCH] drm/ttm: Avoid NULL pointer deref for evicted BOs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It is possible for a BO to exist that is not currently associated with a resource, e.g. because it has been evicted.

When devcoredump tries to read the contents of all BOs for dumping, we need to expect this as well -- in this case, ENODATA is recorded instead of the buffer contents.

Fixes 7d08df5d0bd3 ("drm/ttm: Add ttm_bo_access")
Fixes 09ac4fcb3f25 ("drm/ttm: Implement vm_operations_struct.access v2")
Cc stable <[email protected]>
drivers/gpu/drm/ttm/ttm_bo_vm.c +6 -0
index b47020fca199..e6abc7b40b18 100644
@@ -434,6 +434,11 @@ int ttm_bo_access(struct ttm_buffer_object *bo, unsigned long offset,
 	if (ret)
 		return ret;
 
+	if (!bo->resource) {
+		ret = -ENODATA;
+		goto unlock;
+	}
+
 	switch (bo->resource->mem_type) {
 	case TTM_PL_SYSTEM:
 		fallthrough;
@@ -448,6 +453,7 @@ int ttm_bo_access(struct ttm_buffer_object *bo, unsigned long offset,
 			ret = -EIO;
 	}
 
+unlock:
 	ttm_bo_unreserve(bo);
 
 	return ret;