Skip to content

Commit fcf6a49

Browse files
Wayne Linalexdeucher
authored andcommitted
drm/amd/display: Don't refer to dc_sink in is_dsc_need_re_compute
[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]>
1 parent fc6d61a commit fcf6a49

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ amdgpu_dm_mst_connector_early_unregister(struct drm_connector *connector)
182182
dc_sink_release(dc_sink);
183183
aconnector->dc_sink = NULL;
184184
aconnector->edid = NULL;
185+
aconnector->dsc_aux = NULL;
186+
port->passthrough_aux = NULL;
185187
}
186188

187189
aconnector->mst_status = MST_STATUS_DEFAULT;
@@ -498,6 +500,8 @@ dm_dp_mst_detect(struct drm_connector *connector,
498500
dc_sink_release(aconnector->dc_sink);
499501
aconnector->dc_sink = NULL;
500502
aconnector->edid = NULL;
503+
aconnector->dsc_aux = NULL;
504+
port->passthrough_aux = NULL;
501505

502506
amdgpu_dm_set_mst_status(&aconnector->mst_status,
503507
MST_REMOTE_EDID | MST_ALLOCATE_NEW_PAYLOAD | MST_CLEAR_ALLOCATED_PAYLOAD,
@@ -1238,14 +1242,6 @@ static bool is_dsc_need_re_compute(
12381242
if (!aconnector || !aconnector->dsc_aux)
12391243
continue;
12401244

1241-
/*
1242-
* check if cached virtual MST DSC caps are available and DSC is supported
1243-
* as per specifications in their Virtual DPCD registers.
1244-
*/
1245-
if (!(aconnector->dc_sink->dsc_caps.dsc_dec_caps.is_dsc_supported ||
1246-
aconnector->dc_link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.dsc_support.DSC_PASSTHROUGH_SUPPORT))
1247-
continue;
1248-
12491245
stream_on_link[new_stream_on_link_num] = aconnector;
12501246
new_stream_on_link_num++;
12511247

0 commit comments

Comments
 (0)