summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-12-14 05:15:59 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-12-14 05:15:59 +0000
commit1aed38c51585a914ee6325572ba027000e3cae79 (patch)
treea1619b0c69b79600372fbaaa9319376f712abd10
parent2d1ca0cf680f87778c8d955e8caaef4ed0521958 (diff)
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
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/gfx_v11_0.c2
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/gfx_v8_0.c4
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/gfx_v9_0.c4
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;