]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/amd/display: Check NULL connector before it is used
authorAlex Hung <alex.hung@amd.com>
Wed, 19 Feb 2025 04:14:47 +0000 (21:14 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 5 Mar 2025 15:39:35 +0000 (10:39 -0500)
[Why & How]
amdgpu_dm_find_first_crtc_matching_connector can return NULL.
It is necessary to the returned connector before passing it
drm_atomic_get_new_connector_state which always assumes connector is
not NULL.

Reviewed-by: Roman Li <roman.li@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c

index 056b1719895654ca07fc47d5096e1e96dd5faf1e..7ceedf626d23fe59c1b97392fa26bf8a70bb0b68 100644 (file)
@@ -1632,6 +1632,9 @@ int pre_validate_dsc(struct drm_atomic_state *state,
                        connector =
                                amdgpu_dm_find_first_crtc_matching_connector(state,
                                                                             state->crtcs[ind].ptr);
+                       if (!connector)
+                               continue;
+
                        drm_new_conn_state =
                                drm_atomic_get_new_connector_state(state,
                                                                   connector);