From: jsg Date: Mon, 27 Mar 2023 03:43:02 +0000 (+0000) Subject: drm/amd/display: Fix potential null-deref in dm_resume X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d821b1c71e7b320c2abf0a3c8c92be6de52619f4;p=openbsd drm/amd/display: Fix potential null-deref in dm_resume From Roman Li 8e365f1bd672cc9320a936f6ae6f8087aa40e9bc in linux-6.1.y/6.1.16 7a7175a2cd84b7874bebbf8e59f134557a34161b in mainline linux --- diff --git a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 0f6d9ba64f0..d9b2cfbd98c 100644 --- a/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -2746,12 +2746,14 @@ static int dm_resume(void *handle) drm_for_each_connector_iter(connector, &iter) { aconnector = to_amdgpu_dm_connector(connector); + if (!aconnector->dc_link) + continue; + /* * this is the case when traversing through already created * MST connectors, should be skipped */ - if (aconnector->dc_link && - aconnector->dc_link->type == dc_connection_mst_branch) + if (aconnector->dc_link->type == dc_connection_mst_branch) continue; mutex_lock(&aconnector->hpd_lock);