[PATCH v2] drm/amdkfd: validate pdd where it acquired first

Oded Gabbay oded.gabbay at gmail.com
Thu Jul 9 02:31:16 PDT 2015


On Thu, Jul 9, 2015 at 12:11 PM, Maninder Singh <maninder1.s at samsung.com> wrote:
> Currently pdd is validate after dereferencing it, which is
> not correct, Thus validate pdd before its first use.
>
> Signed-off-by: Maninder Singh <maninder1.s at samsung.com>
> ---
> v1: remove validation of pdd after its usage
> v2: do validation at first place rather than removing
>
>  drivers/gpu/drm/amd/amdkfd/kfd_process.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> index 8a1f999..9be0070 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> @@ -420,6 +420,12 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid)
>         pqm_uninit(&p->pqm);
>
>         pdd = kfd_get_process_device_data(dev, p);
> +
> +       if (!pdd) {
> +               mutex_unlock(&p->mutex);
> +               return;
> +       }
> +
>         if (pdd->reset_wavefronts) {
>                 dbgdev_wave_reset_wavefronts(pdd->dev, p);
>                 pdd->reset_wavefronts = false;
> @@ -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
>          * because the IOMMU called us.
>          */
> -       if (pdd)
> -               pdd->bound = false;
> +       pdd->bound = false;
>
>         mutex_unlock(&p->mutex);
>  }
> --
> 1.7.9.5
>
Thanks!
Applied to my -fixes tree.

        Oded


More information about the dri-devel mailing list