[PATCH Review 1/1] drm/amdgpu: Fix potential null pointer derefernce

Zhou1, Tao Tao.Zhou1 at amd.com
Thu Sep 28 03:57:30 UTC 2023


[AMD Official Use Only - General]

Reviewed-by: Tao Zhou <tao.zhou1 at amd.com>

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of
> Stanley.Yang
> Sent: Thursday, September 28, 2023 11:46 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Yang, Stanley <Stanley.Yang at amd.com>
> Subject: [PATCH Review 1/1] drm/amdgpu: Fix potential null pointer derefernce
>
> The amdgpu_ras_get_context may return NULL if device not support ras feature,
> so add check before using.
>
> Signed-off-by: Stanley.Yang <Stanley.Yang at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index cca3faf4dc23..60f8a18592b7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -5391,7 +5391,8 @@ int amdgpu_device_gpu_recover(struct
> amdgpu_device *adev,
>        * Flush RAM to disk so that after reboot
>        * the user can read log and see why the system rebooted.
>        */
> -     if (need_emergency_restart && amdgpu_ras_get_context(adev)-
> >reboot) {
> +     if (need_emergency_restart && amdgpu_ras_get_context(adev) &&
> +             amdgpu_ras_get_context(adev)->reboot) {
>               DRM_WARN("Emergency reboot.");
>
>               ksys_sync_helper();
> --
> 2.25.1



More information about the amd-gfx mailing list