drm/amdkfd: Fix a memory leak in queue creation error handling
authorYong Zhao <Yong.Zhao@amd.com>
Wed, 5 Feb 2020 22:13:54 +0000 (17:13 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 26 Feb 2020 19:20:20 +0000 (14:20 -0500)
When the queue creation failed, some resources were not freed. Fix it.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c

index cfd3aa1e30e3c91c9c4a261c857e29d99c20ce19..3ebbc06f56ee87a2640f87caa94c299231591919 100644 (file)
@@ -329,6 +329,9 @@ int pqm_create_queue(struct process_queue_manager *pqm,
        return retval;
 
 err_create_queue:
+       uninit_queue(q);
+       if (kq)
+               kernel_queue_uninit(kq, false);
        kfree(pqn);
 err_allocate_pqn:
        /* check if queues list is empty unregister process from device */