[PATCH] drm/amdgpu: fix NULL pointer in amdgpu_reset_get_desc
Alex Deucher
alexdeucher at gmail.com
Thu Jun 6 16:36:57 UTC 2024
On Thu, Jun 6, 2024 at 11:52 AM Eric Huang <jinhuieric.huang at amd.com> wrote:
>
> amdgpu_job_ring may return NULL, which causes kernel NULL
> pointer error, using another way to print ring name instead
> of ring->name.
>
> Suggested-by: Lijo Lazar <Lijo.Lazar at amd.com>
> Signed-off-by: Eric Huang <jinhuieric.huang at amd.com>
Acked-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c
> index 9deb41d61e8d..66c1a868c0e1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c
> @@ -164,16 +164,14 @@ void amdgpu_device_unlock_reset_domain(struct amdgpu_reset_domain *reset_domain)
> void amdgpu_reset_get_desc(struct amdgpu_reset_context *rst_ctxt, char *buf,
> size_t len)
> {
> - struct amdgpu_ring *ring;
> -
> if (!buf || !len)
> return;
>
> switch (rst_ctxt->src) {
> case AMDGPU_RESET_SRC_JOB:
> if (rst_ctxt->job) {
> - ring = amdgpu_job_ring(rst_ctxt->job);
> - snprintf(buf, len, "job hang on ring:%s", ring->name);
> + snprintf(buf, len, "job hang on ring:%s",
> + rst_ctxt->job->base.sched->name);
> } else {
> strscpy(buf, "job hang", len);
> }
> --
> 2.34.1
>
More information about the amd-gfx
mailing list