Commit a0f67441 authored by Maninder Singh's avatar Maninder Singh Committed by Oded Gabbay

drm/amdkfd: validate pdd where it acquired first

Currently pdd is validate after dereferencing it, which is
not correct, Thus validate pdd before its first use.
Signed-off-by: default avatarManinder Singh <maninder1.s@samsung.com>
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
parent d770e558
...@@ -420,6 +420,12 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid) ...@@ -420,6 +420,12 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid)
pqm_uninit(&p->pqm); pqm_uninit(&p->pqm);
pdd = kfd_get_process_device_data(dev, p); pdd = kfd_get_process_device_data(dev, p);
if (!pdd) {
mutex_unlock(&p->mutex);
return;
}
if (pdd->reset_wavefronts) { if (pdd->reset_wavefronts) {
dbgdev_wave_reset_wavefronts(pdd->dev, p); dbgdev_wave_reset_wavefronts(pdd->dev, p);
pdd->reset_wavefronts = false; pdd->reset_wavefronts = false;
...@@ -431,8 +437,7 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid) ...@@ -431,8 +437,7 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid)
* We don't call amd_iommu_unbind_pasid() here * We don't call amd_iommu_unbind_pasid() here
* because the IOMMU called us. * because the IOMMU called us.
*/ */
if (pdd) pdd->bound = false;
pdd->bound = false;
mutex_unlock(&p->mutex); mutex_unlock(&p->mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment