Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Handle NULL TTM case in xe_bo_move
@ 2025-09-16 22:06 Jonathan Cavitt
  2025-09-16 22:13 ` ✓ CI.KUnit: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jonathan Cavitt @ 2025-09-16 22:06 UTC (permalink / raw)
  To: intel-xe; +Cc: saurabhg.gupta, alex.zuo, jonathan.cavitt

It is possible for xe_bo_move to pass a NULL TTM pointer to
xe_tt_map_sg, which would result in a NULL pointer dereference.
Whether or not this issue realistically occurs, it would be good
to add an error handler to guard agains this.

Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
 drivers/gpu/drm/xe/xe_bo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index 8422f3cab113..bfeae8fd1650 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -834,7 +834,9 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
 		(!ttm && ttm_bo->type == ttm_bo_type_device);
 
 	if (new_mem->mem_type == XE_PL_TT) {
-		ret = xe_tt_map_sg(xe, ttm);
+		ret = -ENOENT;
+		if (ttm)
+			ret = xe_tt_map_sg(xe, ttm);
 		if (ret)
 			goto out;
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-09-17 10:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-16 22:06 [PATCH] drm/xe: Handle NULL TTM case in xe_bo_move Jonathan Cavitt
2025-09-16 22:13 ` ✓ CI.KUnit: success for " Patchwork
2025-09-16 22:49 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-17  2:41 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-17 10:01 ` [PATCH] " Matthew Auld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox