diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-07-19 10:45:09 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-07-19 10:45:09 +0000 |
commit | 60b7b3b47b155b64aff987f77b19ede0b5ee4044 (patch) | |
tree | 3af26bc408a7448ce5f778e2e211453f123b5dff /sys/dev | |
parent | d2bb01d3ce05767f49de164e7eb89f6de62b430a (diff) |
drm/dp: Handle zeroed port counts in drm_dp_read_downstream_info()
From Lyude Paul
2998599fb16cd99b0384d2517bbd409a233a9695 in linux 5.10.y/5.10.51
205bb69a90363541a634a662a599fddb95956524 in mainline linux
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/drm/drm_dp_helper.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/drm_dp_helper.c b/sys/dev/pci/drm/drm_dp_helper.c index d6343f9f2e5..f568aa50ca3 100644 --- a/sys/dev/pci/drm/drm_dp_helper.c +++ b/sys/dev/pci/drm/drm_dp_helper.c @@ -602,7 +602,14 @@ int drm_dp_read_downstream_info(struct drm_dp_aux *aux, !(dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT)) return 0; + /* Some branches advertise having 0 downstream ports, despite also advertising they have a + * downstream port present. The DP spec isn't clear on if this is allowed or not, but since + * some branches do it we need to handle it regardless. + */ len = drm_dp_downstream_port_count(dpcd); + if (!len) + return 0; + if (dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DETAILED_CAP_INFO_AVAILABLE) len *= 4; |