@@ -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 */
[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@vger.kernel.org Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> --- drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)