summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2022-08-25 23:49:32 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2022-08-25 23:49:32 +0000
commitfca82ab182bf8dca322bb7ac7f57bd44bc864c3a (patch)
treebd49f002652279f785c5a7e4b94c152c97e48933
parente3be7a0e8307ca47b92e4d1ca282b6d2b5e4a6c0 (diff)
drm/ttm: Fix dummy res NULL ptr deref bug
From Arunpravin Paneer Selvam 76672cd326c146ded2c2712ff257b8908dcf23d8 in linux 5.15.y/5.15.63 cf4b7387c0a842d64bdd7c353e6d3298174a7740 in mainline linux
-rw-r--r--sys/dev/pci/drm/ttm/ttm_bo.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/ttm/ttm_bo.c b/sys/dev/pci/drm/ttm/ttm_bo.c
index d66b8341081..81d9aeafec8 100644
--- a/sys/dev/pci/drm/ttm/ttm_bo.c
+++ b/sys/dev/pci/drm/ttm/ttm_bo.c
@@ -987,7 +987,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
/*
* We might need to add a TTM.
*/
- if (bo->resource->mem_type == TTM_PL_SYSTEM) {
+ if (!bo->resource || bo->resource->mem_type == TTM_PL_SYSTEM) {
ret = ttm_tt_create(bo, true);
if (ret)
return ret;