From 0c230191a8eda179182fa64f027df2a2ba583fa2 Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 15 Aug 2024 03:22:41 +0000 Subject: [PATCH] drm/dp_mst: Skip CSN if topology probing is not done yet From Wayne Lin 28c060cd370d2718345452f4182cba115b7367e8 in linux-6.6.y/6.6.46 ddf983488c3e8d30d5c2e2b315ae7d9cd87096ed in mainline linux --- sys/dev/pci/drm/display/drm_dp_mst_topology.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/dev/pci/drm/display/drm_dp_mst_topology.c b/sys/dev/pci/drm/display/drm_dp_mst_topology.c index 2b77d44f3f4..92511c4c106 100644 --- a/sys/dev/pci/drm/display/drm_dp_mst_topology.c +++ b/sys/dev/pci/drm/display/drm_dp_mst_topology.c @@ -4034,6 +4034,7 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr) if (up_req->msg.req_type == DP_CONNECTION_STATUS_NOTIFY) { const struct drm_dp_connection_status_notify *conn_stat = &up_req->msg.u.conn_stat; + bool handle_csn; drm_dbg_kms(mgr->dev, "Got CSN: pn: %d ldps:%d ddps: %d mcs: %d ip: %d pdt: %d\n", conn_stat->port_number, @@ -4042,6 +4043,16 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr) conn_stat->message_capability_status, conn_stat->input_port, conn_stat->peer_device_type); + + mutex_lock(&mgr->probe_lock); + handle_csn = mgr->mst_primary->link_address_sent; + mutex_unlock(&mgr->probe_lock); + + if (!handle_csn) { + drm_dbg_kms(mgr->dev, "Got CSN before finish topology probing. Skip it."); + kfree(up_req); + goto out; + } } else if (up_req->msg.req_type == DP_RESOURCE_STATUS_NOTIFY) { const struct drm_dp_resource_status_notify *res_stat = &up_req->msg.u.resource_stat; -- 2.20.1