diff options
author | Yong Zhao <yong.zhao@amd.com> | 2017-11-28 02:29:53 +0300 |
---|---|---|
committer | Oded Gabbay <oded.gabbay@gmail.com> | 2017-11-28 02:29:53 +0300 |
commit | 82c16b4280bc42bc035af566e1480d88666126b1 (patch) | |
tree | ec3b349dea399034994f9593c58ff39413653249 /drivers/gpu/drm/amd/amdkfd/kfd_process.c | |
parent | abb208a8d490bac9d765c45f20cf306757733778 (diff) | |
download | linux-82c16b4280bc42bc035af566e1480d88666126b1.tar.xz |
drm/amdkfd: Return NULL if kfd_lookup_process_by_pasid fails
If no matching process is found, return NULL instead of a pointer
to the last process in the kfd_processes_table.
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd/kfd_process.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_process.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index 509f987f4994..93f90191509f 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -570,7 +570,7 @@ bool kfd_has_process_device_data(struct kfd_process *p) /* This increments the process->ref counter. */ struct kfd_process *kfd_lookup_process_by_pasid(unsigned int pasid) { - struct kfd_process *p; + struct kfd_process *p, *ret_p = NULL; unsigned int temp; int idx = srcu_read_lock(&kfd_processes_srcu); @@ -578,13 +578,14 @@ struct kfd_process *kfd_lookup_process_by_pasid(unsigned int pasid) hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) { if (p->pasid == pasid) { kref_get(&p->ref); + ret_p = p; break; } } srcu_read_unlock(&kfd_processes_srcu, idx); - return p; + return ret_p; } int kfd_reserved_mem_mmap(struct kfd_process *process, |