mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
drm/amdgpu: fix memory overflow in the IB test
commit 6b0b7789a7
upstream.
Fix a memory overflow issue in the gfx IB test
for some ASICs. At least 20 bytes are needed for
the IB test packet.
v2: correct code indentation errors. (Christian)
Signed-off-by: Tim Huang <Tim.Huang@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5ffd8c73d1
commit
6dfccebfec
4 changed files with 7 additions and 7 deletions
|
@ -398,7 +398,7 @@ static int gfx_v11_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
|
||||||
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
|
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
|
||||||
cpu_ptr = &adev->wb.wb[index];
|
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) {
|
if (r) {
|
||||||
DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
|
DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
|
||||||
goto err1;
|
goto err1;
|
||||||
|
|
|
@ -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);
|
gpu_addr = adev->wb.gpu_addr + (index * 4);
|
||||||
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
|
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
|
||||||
memset(&ib, 0, sizeof(ib));
|
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)
|
if (r)
|
||||||
goto err1;
|
goto err1;
|
||||||
|
|
||||||
|
|
|
@ -1039,8 +1039,8 @@ static int gfx_v9_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
|
||||||
gpu_addr = adev->wb.gpu_addr + (index * 4);
|
gpu_addr = adev->wb.gpu_addr + (index * 4);
|
||||||
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
|
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
|
||||||
memset(&ib, 0, sizeof(ib));
|
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)
|
if (r)
|
||||||
goto err1;
|
goto err1;
|
||||||
|
|
||||||
|
|
|
@ -296,8 +296,8 @@ static int gfx_v9_4_3_ring_test_ib(struct amdgpu_ring *ring, long timeout)
|
||||||
gpu_addr = adev->wb.gpu_addr + (index * 4);
|
gpu_addr = adev->wb.gpu_addr + (index * 4);
|
||||||
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
|
adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
|
||||||
memset(&ib, 0, sizeof(ib));
|
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)
|
if (r)
|
||||||
goto err1;
|
goto err1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue