From a8f13b42dbdfaa4e533ffce1995f3feee788619c Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 25 Aug 2022 23:49:31 +0000 Subject: [PATCH] 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 --- sys/dev/pci/drm/ttm/ttm_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.20.1