From b2bc41bb2c8ea5e8edc83c065ac5b60c550dc18f Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 27 May 2024 00:54:00 +0000 Subject: [PATCH] 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 --- sys/dev/pci/drm/amd/amdgpu/amdgpu_ras.c | 3 +++ 1 file changed, 3 insertions(+) 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 { -- 2.20.1