From: Wayne Lin <[email protected]>

[ Upstream commit fcf6a49d79923a234844b8efe830a61f3f0584e4 ]

[Why]
When unplug one of monitors connected after mst hub, encounter null pointer 
dereference.

It's due to dc_sink get released immediately in early_unregister() or 
detect_ctx(). When
commit new state which directly referring to info stored in dc_sink will cause 
null pointer
dereference.

[how]
Remove redundant checking condition. Relevant condition should already be 
covered by checking
if dsc_aux is null or not. Also reset dsc_aux to NULL when the connector is 
disconnected.

Reviewed-by: Jerry Zuo <[email protected]>
Acked-by: Zaeem Mohamed <[email protected]>
Signed-off-by: Wayne Lin <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
[The deleted codes in this fix is introduced by commit b9b5a82c5321
("drm/amd/display: Fix DSC-re-computing") after 6.11.]
Signed-off-by: Jianqi Ren <[email protected]>
Signed-off-by: He Zhe <[email protected]>
---
Verified the build test
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 5eb994ed5471..6bb590bc7c19 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -183,6 +183,8 @@ amdgpu_dm_mst_connector_early_unregister(struct 
drm_connector *connector)
                dc_sink_release(dc_sink);
                aconnector->dc_sink = NULL;
                aconnector->edid = NULL;
+               aconnector->dsc_aux = NULL;
+               port->passthrough_aux = NULL;
        }
 
        aconnector->mst_status = MST_STATUS_DEFAULT;
@@ -487,6 +489,8 @@ dm_dp_mst_detect(struct drm_connector *connector,
                dc_sink_release(aconnector->dc_sink);
                aconnector->dc_sink = NULL;
                aconnector->edid = NULL;
+               aconnector->dsc_aux = NULL;
+               port->passthrough_aux = NULL;
 
                amdgpu_dm_set_mst_status(&aconnector->mst_status,
                        MST_REMOTE_EDID | MST_ALLOCATE_NEW_PAYLOAD | 
MST_CLEAR_ALLOCATED_PAYLOAD,
-- 
2.34.1

Reply via email to