drm/amdgpu: stop context leak in the error path
authorChristian König <christian.koenig@amd.com>
Tue, 7 Jul 2015 15:27:03 +0000 (17:27 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 16 Jul 2015 16:39:39 +0000 (12:39 -0400)
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

index 469b6f2364bc0be43c7e8de091e6c9c766baf0f5..1f040d85ac47fe336f609a0cf9d39ac59b94f665 100644 (file)
@@ -817,12 +817,16 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data,
 
        r = amdgpu_cs_get_ring(adev, wait->in.ip_type, wait->in.ip_instance,
                               wait->in.ring, &ring);
-       if (r)
+       if (r) {
+               amdgpu_ctx_put(ctx);
                return r;
+       }
 
        r = amdgpu_fence_recreate(ring, filp, wait->in.handle, &fence);
-       if (r)
+       if (r) {
+               amdgpu_ctx_put(ctx);
                return r;
+       }
 
        r = fence_wait_timeout(&fence->base, true, timeout);
        amdgpu_fence_unref(&fence);