Skip to content

Commit a589fa1

Browse files
srishanmalexdeucher
authored andcommitted
drm/amd/display: Fix possible NULL dereference on device remove/driver unload
As part of a cleanup amdgpu_dm_fini() function, which is typically called when a device is being shut down or a driver is being unloaded The below error message suggests that there is a potential null pointer dereference issue with adev->dm.dc. In the below, line of code where adev->dm.dc is used without a preceding null check: for (i = 0; i < adev->dm.dc->caps.max_links; i++) { To fix this issue, add a null check for adev->dm.dc before this line. Reported by smatch: drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1959 amdgpu_dm_fini() error: we previously assumed 'adev->dm.dc' could be null (see line 1943) Fixes: 006c26a ("drm/amd/display: Fix crash on device remove/driver unload") Cc: Andrey Grodzovsky <[email protected]> Cc: Harry Wentland <[email protected]> Cc: Rodrigo Siqueira <[email protected]> Cc: Aurabindo Pillai <[email protected]> Signed-off-by: Srinivasan Shanmugam <[email protected]> Reviewed-by: Roman Li <[email protected]> Reviewed-by: Aurabindo Pillai <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent a538dab commit a589fa1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,7 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
19561956
&adev->dm.dmub_bo_gpu_addr,
19571957
&adev->dm.dmub_bo_cpu_addr);
19581958

1959-
if (adev->dm.hpd_rx_offload_wq) {
1959+
if (adev->dm.hpd_rx_offload_wq && adev->dm.dc) {
19601960
for (i = 0; i < adev->dm.dc->caps.max_links; i++) {
19611961
if (adev->dm.hpd_rx_offload_wq[i].wq) {
19621962
destroy_workqueue(adev->dm.hpd_rx_offload_wq[i].wq);

0 commit comments

Comments
 (0)