Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c44ed568 authored by Dave Airlie's avatar Dave Airlie Committed by Sasha Levin
Browse files

drm/dp/mst: take lock around looking up the branch device on hpd irq



[ Upstream commit 9eb1e57f564d4e6e10991402726cc83fe0b9172f ]

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: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 0e266aad
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1152,6 +1152,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++) {
@@ -1171,6 +1173,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;
}