drm/amdgpu: Fix possible NULL dereference in amdgpu_ras_query_error_status_helper()

commit b8d55a90fd55b767c25687747e2b24abd1ef8680 upstream.

This fixes CVE-2023-52585

Return invalid error code -EINVAL for invalid block id.

Fixes the below:

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1183 amdgpu_ras_query_error_status_helper() error: we previously assumed 'info' could be null (see line 1176)

Suggested-by: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: Tao Zhou <tao.zhou1@amd.com>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
This commit is contained in:
Srinivasan Shanmugam 2023-12-26 15:32:19 +05:30 committed by Jianping Liu
parent 5634366348
commit ace94bba18
1 changed files with 6 additions and 1 deletions

View File

@ -1019,9 +1019,14 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev,
struct ras_query_if *info)
{
struct amdgpu_ras_block_object *block_obj = NULL;
struct ras_manager *obj = amdgpu_ras_find_obj(adev, &info->head);
struct ras_manager *obj;
struct ras_err_data err_data = {0, 0, 0, NULL};
if (!info)
return -EINVAL;
obj = amdgpu_ras_find_obj(adev, &info->head);
if (!obj)
return -EINVAL;