There is an error path in igt_ppgtt_alloc(), which leads to ww
object being passed down to i915_gem_ww_ctx_fini() without
initialization. Correct that by putting ppgtt->vm and returning
early.

Fixes: 480ae79537b2 ("drm/i915/selftests: Prepare gtt tests for obj->mm.lock 
removal")
Signed-off-by: Krzysztof Karas <krzysztof.ka...@intel.com>
---
Changelog:
* v1 -> v2:
        Avoid calling i915_gem_ww_ctx_fini() with zeroed context
        by returning early (Sebastian).

 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c 
b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
index 5816d515203a..d94a5b88f442 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
@@ -167,8 +167,10 @@ static int igt_ppgtt_alloc(void *arg)
        if (IS_ERR(ppgtt))
                return PTR_ERR(ppgtt);
 
-       if (!ppgtt->vm.allocate_va_range)
-               goto err_ppgtt_cleanup;
+       if (!ppgtt->vm.allocate_va_range) {
+               i915_vm_put(&ppgtt->vm);
+               return 0;
+       }
 
        /*
         * While we only allocate the page tables here and so we could
-- 
2.43.0

Reply via email to