drm/amd/display: Fix potential null-deref in dm_resume
authorjsg <jsg@openbsd.org>
Mon, 27 Mar 2023 03:43:02 +0000 (03:43 +0000)
committerjsg <jsg@openbsd.org>
Mon, 27 Mar 2023 03:43:02 +0000 (03:43 +0000)
From Roman Li
8e365f1bd672cc9320a936f6ae6f8087aa40e9bc in linux-6.1.y/6.1.16
7a7175a2cd84b7874bebbf8e59f134557a34161b in mainline linux

sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 0f6d9ba..d9b2cfb 100644 (file)
@@ -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);