[PATCH 3/4] drm/dp_mst: Put connector of disconnected end device when handling CSN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[Why]
Now, after receiving CSN notifying that a port is disconnected, we can
unregister child connectors under a branch device via
drm_dp_mst_topology_put_mstb() in drm_dp_port_set_pdt(). However, if
this reported disconnected port is used to connect to an end
device(sst/dp_to_legace converter), we won't unregiser such connector.

[How]
Take sst/dp_to_legacy conveter device into consideration, also
unregister connectors of this case when handling CSN.

In addition, check whether port->connector exist to avoid
null pointer dereference.

Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wayne Lin <Wayne.Lin@xxxxxxx>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index f13c7187b07f..85a959427247 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2567,6 +2567,12 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb,
 	else if (create_connector)
 		drm_dp_mst_port_add_connector(mstb, port);
 
+	if (port->connector && port->pdt == DP_PEER_DEVICE_NONE) {
+		drm_connector_unregister(port->connector);
+		drm_connector_put(port->connector);
+		port->connector = NULL;
+	}
+
 out:
 	drm_dp_mst_topology_put_port(port);
 	if (dowork)
@@ -4442,10 +4448,12 @@ int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,
 	req_slots = DIV_ROUND_UP(pbn, pbn_div);
 
 	drm_dbg_atomic(mgr->dev, "[CONNECTOR:%d:%s] [MST PORT:%p] VCPI %d -> %d\n",
-		       port->connector->base.id, port->connector->name,
+		       port->connector ? port->connector->base.id : 0,
+		       port->connector ? port->connector->name : "NULL",
 		       port, prev_slots, req_slots);
 	drm_dbg_atomic(mgr->dev, "[CONNECTOR:%d:%s] [MST PORT:%p] PBN %d -> %d\n",
-		       port->connector->base.id, port->connector->name,
+		       port->connector ? port->connector->base.id : 0,
+		       port->connector ? port->connector->name : "NULL",
 		       port, prev_bw, pbn);
 
 	/* Add the new allocation to the state */
-- 
2.17.1




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux