diff options
| author | Felix Kuehling <[email protected]> | 2021-02-12 06:37:52 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2021-02-22 23:03:07 +0000 |
| commit | 172e4ee233f322d6d38a438f9c1177c03f37b241 (patch) | |
| tree | 60d26f7dfdd485df5b0991a0e26acd0cf4b97209 | |
| parent | drm/amdkfd: Use mmu_notifier_get (diff) | |
| download | kernel-172e4ee233f322d6d38a438f9c1177c03f37b241.tar.gz kernel-172e4ee233f322d6d38a438f9c1177c03f37b241.zip | |
drm/amdkfd: Cleanup kfd_process if init_cwsr_apu fails
If init_cwsr_apu fails, we currently leave the kfd_process structure in
place anyway. The next kfd_open will then succeed, using the existing
kfd_process structure. Fix that by cleaning up the kfd_process after a
failure in init_cwsr_apu.
Signed-off-by: Felix Kuehling <[email protected]>
Reviewed-by: Philip Yang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
| -rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_process.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index ddef335f78db..65ea0381a892 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -775,10 +775,8 @@ struct kfd_process *kfd_create_process(struct file *filep) goto out; ret = kfd_process_init_cwsr_apu(process, filep); - if (ret) { - process = ERR_PTR(ret); - goto out; - } + if (ret) + goto out_destroy; if (!procfs.kobj) goto out; @@ -826,6 +824,14 @@ out: mutex_unlock(&kfd_processes_mutex); return process; + +out_destroy: + hash_del_rcu(&process->kfd_processes); + mutex_unlock(&kfd_processes_mutex); + synchronize_srcu(&kfd_processes_srcu); + /* kfd_process_free_notifier will trigger the cleanup */ + mmu_notifier_put(&process->mmu_notifier); + return ERR_PTR(ret); } struct kfd_process *kfd_get_process(const struct task_struct *thread) |
