Commit 062ea90
drm/amd: Fix NULL pointer dereference in device cleanup
When GPU initialization fails due to an unsupported HW block
IP blocks may have a NULL version pointer. During cleanup in
amdgpu_device_fini_hw, the code calls amdgpu_device_set_pg_state and
amdgpu_device_set_cg_state which iterate over all IP blocks and access
adev->ip_blocks[i].version without NULL checks, leading to a kernel
NULL pointer dereference.
Add NULL checks for adev->ip_blocks[i].version in both
amdgpu_device_set_cg_state and amdgpu_device_set_pg_state to prevent
dereferencing NULL pointers during GPU teardown when initialization has
failed.
Fixes: 39fc2bc ("drm/amdgpu: Protect GPU register accesses in powergated state in some paths")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit b7ac774)
Cc: stable@vger.kernel.org1 parent 9d4837a commit 062ea90
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3247 | 3247 | | |
3248 | 3248 | | |
3249 | 3249 | | |
| 3250 | + | |
| 3251 | + | |
3250 | 3252 | | |
3251 | 3253 | | |
3252 | 3254 | | |
| |||
3286 | 3288 | | |
3287 | 3289 | | |
3288 | 3290 | | |
| 3291 | + | |
| 3292 | + | |
3289 | 3293 | | |
3290 | 3294 | | |
3291 | 3295 | | |
| |||
0 commit comments