summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Roberto de Souza <jose.souza@intel.com>2020-01-29 15:24:48 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-19 19:54:07 +0100
commitf0d2fe7a8595571986df9703617c5e1d91766f88 (patch)
tree35b6d07ab0ab78af5811c0d283ac59a7509802f0
parentc578f31bba29d2c6a97d2ad279ae3cd261dcc786 (diff)
downloadlinux-f0d2fe7a8595571986df9703617c5e1d91766f88.tar.gz
linux-f0d2fe7a8595571986df9703617c5e1d91766f88.tar.bz2
linux-f0d2fe7a8595571986df9703617c5e1d91766f88.zip
drm/mst: Fix possible NULL pointer dereference in drm_dp_mst_process_up_req()
commit 8ccb5bf7619c6523e7a4384a84b72e7be804298c upstream. 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 <lyude@redhat.com> Cc: Sean Paul <sean@poorly.run> Cc: <stable@vger.kernel.org> # v5.5+ Signed-off-by: José Roberto de Souza <jose.souza@intel.com> [added cc to stable] Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200129232448.84704-1-jose.souza@intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/gpu/drm/drm_dp_mst_topology.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 141ba31cf548..6cd90cb4b6b1 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -3772,7 +3772,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);
}