drm/amdgpu: Fix the null pointer dereference for amdgpu_ras_reset_error_status
Subsystems (2)
PATCH 1/1 drm/amdgpu: Fix the null pointer dereference for amdgpu_ras_reset_error_status
Check return value and conduct null pointer handling to avoid null pointer dereference.
Signed-off-by Bob Zhou <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3 -0
@@ -1442,6 +1442,9 @@ int amdgpu_ras_reset_error_status(struct amdgpu_device *adev,if (amdgpu_ras_reset_error_count (adev, block) == -EOPNOTSUPP )return 0 ; +if (!block_obj || !block_obj->hw_ops) +return -EINVAL ; +if ((block ==AMDGPU_RAS_BLOCK__GFX ) || (block ==AMDGPU_RAS_BLOCK__MMHUB )) {if (block_obj->hw_ops->reset_ras_error_status)
Signature · 1 line
2.34.1