drm/amdgpu: bounds check xcp_id in release_sched

Avoid out-of-bounds xcp[] access, e.g. when xcp_id is
AMDGPU_XCP_NO_PARTITION.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Lijo Lazar 2026-06-16 10:57:44 +05:30 committed by Alex Deucher
parent b9086b6e75
commit 6e8a3c24bd

View File

@ -476,7 +476,8 @@ void amdgpu_xcp_release_sched(struct amdgpu_device *adev,
if (drm_sched_wqueue_ready(sched)) {
struct amdgpu_ring *ring = to_amdgpu_ring(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);
}
}