From: Dave Airlie Date: Mon, 22 Jun 2015 04:40:44 +0000 (+1000) Subject: drm/dp/mst: take lock around looking up the branch device on hpd irq X-Git-Tag: v4.1.4~139 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e60bd2d701a57d0cd9fe53de5e1426af03874c0d;p=users%2Fjedix%2Flinux-maple.git drm/dp/mst: take lock around looking up the branch device on hpd irq commit 9eb1e57f564d4e6e10991402726cc83fe0b9172f upstream. If we are doing an MST transaction and we've gotten HPD and we lookup the device from the incoming msg, we should take the mgr lock around it, so that mst_primary and mstb->ports are valid. Reviewed-by: Daniel Vetter Signed-off-by: Dave Airlie Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index c0069e8bb4bb..9dce95331624 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -1171,6 +1171,8 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_ struct drm_dp_mst_port *port; int i; /* find the port by iterating down */ + + mutex_lock(&mgr->lock); mstb = mgr->mst_primary; for (i = 0; i < lct - 1; i++) { @@ -1190,6 +1192,7 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_ } } kref_get(&mstb->kref); + mutex_unlock(&mgr->lock); return mstb; }