drm/ttm: Fix dummy res NULL ptr deref bug
authorjsg <jsg@openbsd.org>
Thu, 25 Aug 2022 23:49:31 +0000 (23:49 +0000)
committerjsg <jsg@openbsd.org>
Thu, 25 Aug 2022 23:49:31 +0000 (23:49 +0000)
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

index d66b834..81d9aea 100644 (file)
@@ -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;