RE: [PATCH] drm/amd: add the checking to avoid NULL pointer dereference

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

 




> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of
> Sharma, Deepak
> Sent: Thursday, November 22, 2018 10:37 AM
> To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> Cc: Sharma, Deepak <Deepak.Sharma@xxxxxxx>
> Subject: [PATCH] drm/amd: add the checking to avoid NULL pointer
> dereference
> 
> when returned fence is not valid mostly due to userspace ignored previous
> error causes NULL pointer dereference
> 
> Signed-off-by: Deepak Sharma <Deepak.Sharma@xxxxxxx>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 024dfbd87f11..c85bb313e6df 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -1420,6 +1420,8 @@ int amdgpu_cs_fence_to_handle_ioctl(struct
> drm_device *dev, void *data,
>  	fence = amdgpu_cs_get_fence(adev, filp, &info->in.fence);
>  	if (IS_ERR(fence))
>  		return PTR_ERR(fence);
> +	if (!fence)
> +		return -EINVAL;
Could you move them into the end of amdgpu_cs_get_fence()? Like:
If (!fence)
	return ERR_PTR(-EINVAL);

Thanks,
-David
> 
>  	switch (info->in.what) {
>  	case AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ:
> --
> 2.15.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




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

  Powered by Linux