7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Erhan Bilgili [ Upstream commit 122e864861144150e905012b5fb52e63ad5de68d ] Return -ETIMEDOUT when the fence wait before submission expires instead of reporting success without submitting the packet. Fixes: 34e087e8920e ("drm/amdgpu/mes: fix mes ring buffer overflow") Reviewed-by: Alex Deucher Signed-off-by: Erhan Bilgili Signed-off-by: Alex Deucher (cherry picked from commit 34341594a87b4a3f28be41e3e70a4787f02b3d9e) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 4 +++- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index c57bcb9a98b19..10bed6f38f309 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c @@ -218,8 +218,10 @@ static int mes_v11_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, r = amdgpu_fence_wait_polling(ring, seq - ring->fence_drv.num_fences_mask, timeout); - if (r < 1) + if (r < 1) { + r = -ETIMEDOUT; goto error_undo; + } api_status = (struct MES_API_STATUS *)((char *)pkt + api_status_off); api_status->api_completion_fence_addr = status_gpu_addr; diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c index ee72afdb0a1d3..bb9892d1bd051 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c @@ -195,8 +195,10 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, r = amdgpu_fence_wait_polling(ring, seq - ring->fence_drv.num_fences_mask, timeout); - if (r < 1) + if (r < 1) { + r = -ETIMEDOUT; goto error_undo; + } api_status = (struct MES_API_STATUS *)((char *)pkt + api_status_off); api_status->api_completion_fence_addr = status_gpu_addr; -- 2.53.0