[PATCH] drm/ttm: check null pointer before accessing when swapping
Guchun Chen
guchun.chen at amd.com
Tue Jul 18 02:11:11 UTC 2023
Add a check to avoid null pointer dereference.
Fixes: a2848d08742c ("drm/ttm: never consider pinned BOs for eviction&swap")
Signed-off-by: Guchun Chen <guchun.chen at amd.com>
---
drivers/gpu/drm/ttm/ttm_bo.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 7139a522b2f3..54e3083076b7 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -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;
}
--
2.25.1
More information about the amd-gfx
mailing list