From: jsg Date: Fri, 3 Nov 2023 03:29:36 +0000 (+0000) Subject: drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2fb2b219688b2fdf6b8d6da44686f926b105cd58;p=openbsd drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper() From Lukasz Majczak 6c668e2f338bde76279aeaf4d4c035c4196a479b in linux-6.1.y/6.1.61 3d887d512494d678b17c57b835c32f4e48d34f26 in mainline linux --- diff --git a/sys/dev/pci/drm/display/drm_dp_mst_topology.c b/sys/dev/pci/drm/display/drm_dp_mst_topology.c index a0f8b05792a..cb6a61a2525 100644 --- a/sys/dev/pci/drm/display/drm_dp_mst_topology.c +++ b/sys/dev/pci/drm/display/drm_dp_mst_topology.c @@ -2584,14 +2584,14 @@ static struct drm_dp_mst_branch *get_mst_branch_device_by_guid_helper( struct drm_dp_mst_branch *found_mstb; struct drm_dp_mst_port *port; + if (!mstb) + return NULL; + if (memcmp(mstb->guid, guid, 16) == 0) return mstb; list_for_each_entry(port, &mstb->ports, next) { - if (!port->mstb) - continue; - found_mstb = get_mst_branch_device_by_guid_helper(port->mstb, guid); if (found_mstb)