drm/amdkfd: Fix error handling in kfd_criu_restore_events
authorFelix Kuehling <Felix.Kuehling@amd.com>
Thu, 3 Nov 2022 21:01:46 +0000 (17:01 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 9 Nov 2022 22:22:37 +0000 (17:22 -0500)
mutex_unlock before the exit label because all the error code paths that
jump there didn't take that lock. This fixes unbalanced locking errors
in case of restore errors.

Fixes: 40e8a766a761 ("drm/amdkfd: CRIU checkpoint and restore events")
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_events.c

index 83e3ce9f604911b554f5e1a600e1dee49db02b3a..729d26d648af3b7795ab45a090fc332809f4e3c4 100644 (file)
@@ -506,6 +506,7 @@ int kfd_criu_restore_event(struct file *devkfd,
                ret = create_other_event(p, ev, &ev_priv->event_id);
                break;
        }
+       mutex_unlock(&p->event_mutex);
 
 exit:
        if (ret)
@@ -513,8 +514,6 @@ exit:
 
        kfree(ev_priv);
 
-       mutex_unlock(&p->event_mutex);
-
        return ret;
 }