From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 1/2] drm/dp: look up the mstb passed into work function (v2)
Date: Mon, 22 Jun 2015 14:40:43 +1000 [thread overview]
Message-ID: <1434948044-26150-1-git-send-email-airlied@gmail.com> (raw)
From: Dave Airlie <airlied@redhat.com>
We should validate the passed in mstb under the lock
this should stop us getting an invalid mstb here.
(first attempt with cancelling work has lockdep issues).
Bugzilla: https://bugs.archlinux.org/task/45369
v2: update bugzilla, add some notes on why passing mst_primary
is okay.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/drm_dp_mst_topology.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index fb65f5d..3c7e5cd 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1198,9 +1198,14 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_
}
static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
- struct drm_dp_mst_branch *mstb)
+ struct drm_dp_mst_branch *mstb_in)
{
struct drm_dp_mst_port *port;
+ struct drm_dp_mst_branch *mstb;
+
+ mstb = drm_dp_get_validated_mstb_ref(mgr, mstb_in);
+ if (!mstb)
+ return;
if (!mstb->link_address_sent) {
drm_dp_send_link_address(mgr, mstb);
@@ -1219,12 +1224,20 @@ static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m
if (port->mstb)
drm_dp_check_and_send_link_address(mgr, port->mstb);
}
+ drm_dp_put_mst_branch_device(mstb);
}
static void drm_dp_mst_link_probe_work(struct work_struct *work)
{
struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, work);
-
+ /*
+ * Note this passes mgr->mst_primary without validation
+ * it could be a) valid, b) NULL, c) some value between
+ * since we haven't taken the lock,
+ * however the validation sequence in check and send
+ * will take the lock, and if the value isn't valid
+ * it will fail appropriately.
+ */
drm_dp_check_and_send_link_address(mgr, mgr->mst_primary);
}
--
2.4.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2015-06-22 4:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-22 4:40 Dave Airlie [this message]
2015-06-22 4:40 ` [PATCH 2/2] drm/dp/mst: take lock around looking up the branch device on hpd irq Dave Airlie
2015-06-22 7:07 ` Daniel Vetter
2015-10-16 9:49 ` Jani Nikula
2015-06-22 7:18 ` [PATCH 1/2] drm/dp: look up the mstb passed into work function (v2) Daniel Vetter
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=1434948044-26150-1-git-send-email-airlied@gmail.com \
--to=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.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