Skip to contentSkip to conversation

drm/ttm: check null pointer before accessing when swapping

PATCH New Guchun Chen 1 participant 1 message Jul 18, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/ttm: check null pointer before accessing when swapping

Add a check to avoid null pointer dereference.

Fixes a2848d08742c ("drm/ttm: never consider pinned BOs for eviction&swap")
---
 drivers/gpu/drm/ttm/ttm_bo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +2 -1
index 7139a522b2f3..54e3083076b7 100644
@@ -519,7 +519,8 @@ static bool ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo,
 
 	if (bo->pin_count) {
 		*locked = false;
-		*busy = false;
+		if (busy)
+			*busy = false;
 		return false;
 	}
 
Signature · 1 line
2.25.1