Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] The patch introduces an unconditional `goto err;` after 
`dma_fence_wait()`, making `dma_fence_put(f)` unreachable dead code and causing 
a guaranteed fence reference leak.
--

commit c63d121e1a1065f00f4d8966f1c7bd3d065b39ef
Author: Wentao Liang <[email protected]>

drm/amdgpu: fix fence reference leak in amdgpu_gfx_run_cleaner_shader_job

This commit intends to fix a potential fence reference leak in the error
handling path of amdgpu_gfx_run_cleaner_shader_job() by ensuring the
fence is properly released if dma_fence_wait() fails.

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index ff5a55f5f3c9e..9a79a80078c3d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c

[ ... ]

> @@ -1729,16 +1729,13 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct 
> amdgpu_ring *ring)
>       f = amdgpu_job_submit(job);
>  
>       r = dma_fence_wait(f, false);
> -     if (r)
> -             goto err;
> +     goto err;
>  
>       dma_fence_put(f);

[Severity: High]
Does this unconditional goto make dma_fence_put() unreachable? 

Since the 'if (r)' condition was removed, execution will always jump to the
err label, bypassing the dma_fence_put(f) call entirely. 

This appears to introduce a guaranteed fence reference leak on every
invocation of amdgpu_gfx_run_cleaner_shader_job(), rather than fixing
the potential error path leak described in the commit message.

>  
> +err:
>       /* Clean up the scheduler entity */
>       drm_sched_entity_destroy(&entity);
> -     return 0;
> -
> -err:
>       return r;
>  }

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to