From: jsg Date: Sat, 31 Jul 2021 06:37:43 +0000 (+0000) Subject: drm/ttm: add a check against null pointer dereference X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7e9d12c22226a501256e3d1e1d46d499935cc4b3;p=openbsd drm/ttm: add a check against null pointer dereference From Zheyu Ma 5c3d753b872a706af9317fef4edfb6b640d8a71e in linux 5.10.y/5.10.55 9e5c772954406829e928dbe59891d08938ead04b in mainline linux --- diff --git a/sys/dev/pci/drm/ttm/ttm_range_manager.c b/sys/dev/pci/drm/ttm/ttm_range_manager.c index bf3e70471a5..72e82537b6a 100644 --- a/sys/dev/pci/drm/ttm/ttm_range_manager.c +++ b/sys/dev/pci/drm/ttm/ttm_range_manager.c @@ -147,6 +147,9 @@ int ttm_range_man_fini(struct ttm_bo_device *bdev, struct drm_mm *mm = &rman->mm; int ret; + if (!man) + return 0; + ttm_resource_manager_set_used(man, false); ret = ttm_resource_manager_force_list_clean(bdev, man);