From: jsg Date: Thu, 25 Aug 2022 23:49:31 +0000 (+0000) Subject: drm/ttm: Fix dummy res NULL ptr deref bug X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a8f13b42dbdfaa4e533ffce1995f3feee788619c;p=openbsd 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 --- 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;