RE: [PATCH v4 1/6] drm/amdkfd: avoid NULL kfd_process_device in kfd_profiler_pmc

From: Russell, Kent

Date: Mon Nov 23 2026 - 10:19:11 EST


AMD General

Reviewed-by: Kent Russell <kent.russell@xxxxxxx>



> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Pierre-
> Eric Pelloux-Prayer
> Sent: November 23, 2026 9:24 AM
> To: Pelloux-Prayer, Pierre-Eric <Pierre-eric.Pelloux-prayer@xxxxxxx>; Kuehling,
> Felix <Felix.Kuehling@xxxxxxx>; Deucher, Alexander
> <Alexander.Deucher@xxxxxxx>; Koenig, Christian
> <Christian.Koenig@xxxxxxx>; David Airlie <airlied@xxxxxxxxx>; Simona Vetter
> <simona@xxxxxxxx>
> Cc: Sashiko-bot <sashiko-bot@xxxxxxxxxx>; amd-gfx@xxxxxxxxxxxxxxxxxxxxx; dri-
> devel@xxxxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH v4 1/6] drm/amdkfd: avoid NULL kfd_process_device in
> kfd_profiler_pmc
>
> ping ?
>
> Le 09/11/2026 à 18:13, Pierre-Eric Pelloux-Prayer a écrit :
> > All other callers of kfd_process_device_data_by_id deal with
> > a possible NULL return value except kfd_profiler_pmc.
> >
> > Check it after the mutex unlock and return -EINVAL as others
> > place do.
> >
> > Reported-by: Sashiko-bot <sashiko-bot@xxxxxxxxxx>
> > Closes: https://sashiko.dev/#/patchset/20261029152000.22001-1-pierre-
> eric.pelloux-prayer@xxxxxxx?part=4
> > Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-
> prayer@xxxxxxx>
> > ---
> > drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> > index 6c710e4a5220..ad086240a6dd 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> > @@ -3463,8 +3463,10 @@ static inline int kfd_profiler_pmc(struct kfd_process
> *p,
> > /* Enable/disable perfcount if requested */
> > mutex_lock(&p->mutex);
> > pdd = kfd_process_device_data_by_id(p, args->gpu_id);
> > - dqm = pdd->dev->dqm;
> > mutex_unlock(&p->mutex);
> > + if (!pdd)
> > + return -EINVAL;
> > + dqm = pdd->dev->dqm;
> >
> > dqm->ops.set_perfcount(dqm, args->perfcount_enable);
> > return status;