From 7cb3d583e0ce2d3f9b415b84cb662f5e03833f81 Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 14 Dec 2023 05:15:58 +0000 Subject: [PATCH] drm/amdgpu: fix memory overflow in the IB test From Tim Huang 613eaee4459dfdae02f48cd02231cc177e9c37e7 in linux-6.1.y/6.1.68 6b0b7789a7a5f3e69185449f891beea58e563f9b in mainline linux --- sys/dev/pci/drm/amd/amdgpu/gfx_v11_0.c | 2 +- sys/dev/pci/drm/amd/amdgpu/gfx_v8_0.c | 4 ++-- sys/dev/pci/drm/amd/amdgpu/gfx_v9_0.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/dev/pci/drm/amd/amdgpu/gfx_v11_0.c b/sys/dev/pci/drm/amd/amdgpu/gfx_v11_0.c index 9f18ba9f5ff..936680e311c 100644 --- a/sys/dev/pci/drm/amd/amdgpu/gfx_v11_0.c +++ b/sys/dev/pci/drm/amd/amdgpu/gfx_v11_0.c @@ -397,7 +397,7 @@ static int gfx_v11_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD); cpu_ptr = &adev->wb.wb[index]; - r = amdgpu_ib_get(adev, NULL, 16, AMDGPU_IB_POOL_DIRECT, &ib); + r = amdgpu_ib_get(adev, NULL, 20, AMDGPU_IB_POOL_DIRECT, &ib); if (r) { DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r); goto err1; diff --git a/sys/dev/pci/drm/amd/amdgpu/gfx_v8_0.c b/sys/dev/pci/drm/amd/amdgpu/gfx_v8_0.c index f6d7381ac4b..c900a5a6808 100644 --- a/sys/dev/pci/drm/amd/amdgpu/gfx_v8_0.c +++ b/sys/dev/pci/drm/amd/amdgpu/gfx_v8_0.c @@ -883,8 +883,8 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) gpu_addr = adev->wb.gpu_addr + (index * 4); adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD); memset(&ib, 0, sizeof(ib)); - r = amdgpu_ib_get(adev, NULL, 16, - AMDGPU_IB_POOL_DIRECT, &ib); + + r = amdgpu_ib_get(adev, NULL, 20, AMDGPU_IB_POOL_DIRECT, &ib); if (r) goto err1; diff --git a/sys/dev/pci/drm/amd/amdgpu/gfx_v9_0.c b/sys/dev/pci/drm/amd/amdgpu/gfx_v9_0.c index 9ec57947684..277c766cc0f 100644 --- a/sys/dev/pci/drm/amd/amdgpu/gfx_v9_0.c +++ b/sys/dev/pci/drm/amd/amdgpu/gfx_v9_0.c @@ -1034,8 +1034,8 @@ static int gfx_v9_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) gpu_addr = adev->wb.gpu_addr + (index * 4); adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD); memset(&ib, 0, sizeof(ib)); - r = amdgpu_ib_get(adev, NULL, 16, - AMDGPU_IB_POOL_DIRECT, &ib); + + r = amdgpu_ib_get(adev, NULL, 20, AMDGPU_IB_POOL_DIRECT, &ib); if (r) goto err1; -- 2.20.1