Skip to content

Commit 9086170

Browse files
author
Maarten Lankhorst
committed
drm/xe: Do not dereference ggtt_node in xe_bo.c
A careful inspection of __xe_ggtt_insert_bo_at() shows that the ggtt_node can always be seen as inserted from xe_bo.c due to the way error handling is performed. The checks are also a little bit too paranoid, since we never create a bo with ggtt_node[id] initialised but not inserted into the GGTT, which can be seen by looking at __xe_ggtt_insert_bo_at() Additionally, the size of the GGTT is never bigger than 4 GB, so adding a check at that level is incorrect. Signed-off-by: Maarten Lankhorst <dev@lankhorst.se> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20260108101014.579906-14-dev@lankhorst.se
1 parent a7ae083 commit 9086170

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,7 +1715,7 @@ static void xe_ttm_bo_destroy(struct ttm_buffer_object *ttm_bo)
17151715
xe_assert(xe, list_empty(&ttm_bo->base.gpuva.list));
17161716

17171717
for_each_tile(tile, xe, id)
1718-
if (bo->ggtt_node[id] && bo->ggtt_node[id]->base.size)
1718+
if (bo->ggtt_node[id])
17191719
xe_ggtt_remove_bo(tile->mem.ggtt, bo);
17201720

17211721
#ifdef CONFIG_PROC_FS
@@ -3609,8 +3609,8 @@ void xe_bo_put(struct xe_bo *bo)
36093609
might_lock(&bo->client->bos_lock);
36103610
#endif
36113611
for_each_tile(tile, xe_bo_device(bo), id)
3612-
if (bo->ggtt_node[id] && bo->ggtt_node[id]->ggtt)
3613-
xe_ggtt_might_lock(bo->ggtt_node[id]->ggtt);
3612+
if (bo->ggtt_node[id])
3613+
xe_ggtt_might_lock(tile->mem.ggtt);
36143614
drm_gem_object_put(&bo->ttm.base);
36153615
}
36163616
}

0 commit comments

Comments
 (0)