From: Wayne Lin <Wayne.Lin@amd.com>
To: <dri-devel@lists.freedesktop.org>
Cc: <lyude@redhat.com>, <Nicholas.Kazlauskas@amd.com>,
<harry.wentland@amd.com>, <jerry.zuo@amd.com>,
<hersenxs.wu@amd.com>, "Wayne Lin" <Wayne.Lin@amd.com>,
<stable@vger.kernel.org>
Subject: [PATCH 3/4] drm/dp_mst: Put connector of disconnected end device when handling CSN
Date: Wed, 21 Jul 2021 00:03:41 +0800 [thread overview]
Message-ID: <20210720160342.11415-4-Wayne.Lin@amd.com> (raw)
In-Reply-To: <20210720160342.11415-1-Wayne.Lin@amd.com>
[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(-)
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
next prev parent reply other threads:[~2021-07-20 16:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210720160342.11415-1-Wayne.Lin@amd.com>
2021-07-20 16:03 ` [PATCH 1/4] drm/dp_mst: Put malloc_kref of vcpi pointing port when disable MST Wayne Lin
2021-07-20 16:03 ` [PATCH 2/4] drm/dp_mst: Only create connector for connected end device Wayne Lin
2021-08-03 23:58 ` Lyude Paul
2021-08-04 0:08 ` Lyude Paul
2021-08-04 7:13 ` Lin, Wayne
2021-08-10 20:45 ` Lyude Paul
2021-08-11 9:49 ` Lin, Wayne
2021-08-18 18:58 ` Lyude Paul
2021-08-20 11:20 ` Lin, Wayne
2021-08-20 20:47 ` Lyude Paul
2021-08-23 6:33 ` Lin, Wayne
2021-08-23 21:18 ` Lyude Paul
2021-08-25 3:35 ` Lin, Wayne
2021-08-31 22:47 ` Lyude Paul
2021-09-01 21:59 ` Lyude Paul
2021-09-14 8:46 ` Lin, Wayne
2021-09-17 17:48 ` Lyude Paul
2021-10-26 3:50 ` Lin, Wayne
2021-10-26 19:34 ` Lyude Paul
2021-10-29 12:11 ` Lin, Wayne
2021-11-02 22:31 ` Lyude Paul
2021-10-12 21:17 ` Lyude Paul
2021-10-15 10:16 ` Lin, Wayne
2021-07-20 16:03 ` Wayne Lin [this message]
2021-07-20 16:03 ` [PATCH 4/4] drm/dp_mst: Release disconnected connectors when resume Wayne Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210720160342.11415-4-Wayne.Lin@amd.com \
--to=wayne.lin@amd.com \
--cc=Nicholas.Kazlauskas@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=hersenxs.wu@amd.com \
--cc=jerry.zuo@amd.com \
--cc=lyude@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox