Re: [PATCH] Staging: drivers/gpu/drm/amd/amdgpu: Fix null pointer deference in amdkfd_fence_get_timeline_name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 20 Sept 2024 at 16:01, Christian König <christian.koenig@xxxxxxx> wrote:
>
> Am 20.09.24 um 11:09 schrieb Dipendra Khadka:
> > '''
> > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c:108:9: error: Null pointer dereference: fence [nullPointer]
> >   return fence->timeline_name;
> >          ^
> > '''
> >
> > The method to_amdgpu_amdkfd_fence can return NULL incase of empty f
> > or f->ops != &amdkfd_fence_ops.Hence, check has been added .
> > If fence is null , then null is returned.
>
> Well NAK, completely nonsense. Calling the function with a NULL fence is
> illegal.

Thanks for enlightening me .

>
> Regards,
> Christian.
>
> >
> > Signed-off-by: Dipendra Khadka <kdipendra88@xxxxxxxxx>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c | 3 +++
> >   1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
> > index 1ef758ac5076..2313babcc944 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
> > @@ -105,6 +105,9 @@ static const char *amdkfd_fence_get_timeline_name(struct dma_fence *f)
> >   {
> >       struct amdgpu_amdkfd_fence *fence = to_amdgpu_amdkfd_fence(f);
> >
> > +     if (!fence)
> > +             return NULL;
> > +
> >       return fence->timeline_name;
> >   }
> >
>

Regards,
Dipendra Khadka




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux