summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-05-27 00:54:01 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-05-27 00:54:01 +0000
commit0295ee2a5c8aaa644c0adb813c34314fa180d382 (patch)
tree2b82f89712b80cc12016f6b1a1b5584cdf8024a2
parentf43caa0206e72c3c602676665867ac1e0e484e52 (diff)
drm/amdgpu: Fix possible NULL dereference in amdgpu_ras_query_error_status_helper()
From Srinivasan Shanmugam c364e7a34c85c2154fb2e47561965d5b5a0b69b1 in linux-6.6.y/6.6.32 b8d55a90fd55b767c25687747e2b24abd1ef8680 in mainline linux
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_ras.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_ras.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_ras.c
index 65db7e29cc3..36af1f4e451 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_ras.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_ras.c
@@ -1029,6 +1029,9 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev,
if (!obj)
return -EINVAL;
+ if (!info || info->head.block == AMDGPU_RAS_BLOCK_COUNT)
+ return -EINVAL;
+
if (info->head.block == AMDGPU_RAS_BLOCK__UMC) {
amdgpu_ras_get_ecc_info(adev, &err_data);
} else {