drm/ttm: add a check against null pointer dereference
authorjsg <jsg@openbsd.org>
Sat, 31 Jul 2021 06:37:43 +0000 (06:37 +0000)
committerjsg <jsg@openbsd.org>
Sat, 31 Jul 2021 06:37:43 +0000 (06:37 +0000)
From Zheyu Ma
5c3d753b872a706af9317fef4edfb6b640d8a71e in linux 5.10.y/5.10.55
9e5c772954406829e928dbe59891d08938ead04b in mainline linux

sys/dev/pci/drm/ttm/ttm_range_manager.c

index bf3e704..72e8253 100644 (file)
@@ -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);