Skip to contentSkip to conversation

drm/mst: Fix possible NULL pointer dereference in drm_dp_mst_process_up_req()

PATCH New José Roberto de Souza 1 participant 1 message Mar 5, 2020 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/2 drm/mst: Fix possible NULL pointer dereference in drm_dp_mst_process_up_req()

According to DP specification, DP_SINK_EVENT_NOTIFY is also a broadcast message but as this function only handles DP_CONNECTION_STATUS_NOTIFY I will only make the static analyzer that caught this issue happy by not calling drm_dp_get_mst_branch_device_by_guid() with a NULL guid, causing drm_dp_mst_process_up_req() to return in the "if (!mstb)" right bellow.

Fixes 9408cc94eb04 ("drm/dp_mst: Handle UP requests asynchronously")
Cc Lyude Paul <[email protected]>
Cc Sean Paul <[email protected]>
Cc <[email protected]> # v5.5+
[added cc to stable]
(cherry picked from commit 8ccb5bf7619c6523e7a4384a84b72e7be804298c)
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_mst_topology.c +2 -1
index cf6cf186e3c6..c9c43371c33c 100644
@@ -3810,7 +3810,8 @@ drm_dp_mst_process_up_req(struct drm_dp_mst_topology_mgr *mgr,
 		else if (msg->req_type == DP_RESOURCE_STATUS_NOTIFY)
 			guid = msg->u.resource_stat.guid;
 
-		mstb = drm_dp_get_mst_branch_device_by_guid(mgr, guid);
+		if (guid)
+			mstb = drm_dp_get_mst_branch_device_by_guid(mgr, guid);
 	} else {
 		mstb = drm_dp_get_mst_branch_device(mgr, hdr->lct, hdr->rad);
 	}