On Tue, Jun 16, 2026 at 2:09 AM Lijo Lazar <[email protected]> wrote:
>
> Avoid out-of-bounds xcp[] access, e.g. when xcp_id is
> AMDGPU_XCP_NO_PARTITION.
>
> Signed-off-by: Lijo Lazar <[email protected]>

Acked-by: Alex Deucher <[email protected]>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
> index 389f69c7d5c3..14cef0264c17 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
> @@ -475,7 +475,8 @@ void amdgpu_xcp_release_sched(struct amdgpu_device *adev,
>         sched = entity->entity.rq->sched;
>         if (drm_sched_wqueue_ready(sched)) {
>                 ring = to_amdgpu_ring(entity->entity.rq->sched);
> -               atomic_dec(&adev->xcp_mgr->xcp[ring->xcp_id].ref_cnt);
> +               if (ring->xcp_id < MAX_XCP)
> +                       atomic_dec(&adev->xcp_mgr->xcp[ring->xcp_id].ref_cnt);
>         }
>  }
>
> --
> 2.49.0
>

Reply via email to