drm/amdgpu: Fix possible NULL dereference in amdgpu_ras_query_error_status_helper()
authorjsg <jsg@openbsd.org>
Mon, 27 May 2024 00:54:00 +0000 (00:54 +0000)
committerjsg <jsg@openbsd.org>
Mon, 27 May 2024 00:54:00 +0000 (00:54 +0000)
From Srinivasan Shanmugam
c364e7a34c85c2154fb2e47561965d5b5a0b69b1 in linux-6.6.y/6.6.32
b8d55a90fd55b767c25687747e2b24abd1ef8680 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_ras.c

index 65db7e2..36af1f4 100644 (file)
@@ -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 {