summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorRD Babiera <rdbabiera@google.com>2025-06-19 01:49:42 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-07-10 17:03:05 +0300
commit45e9444b3b97eaf51a5024f1fea92f44f39b50c6 (patch)
tree6a0376b2692487173f85344cc3708c5aa4b0c23b /include/linux
parent24418bc77a66cb5be9f5a837431ba3674ed8b52f (diff)
downloadlinux-45e9444b3b97eaf51a5024f1fea92f44f39b50c6.tar.xz
usb: typec: altmodes/displayport: do not index invalid pin_assignments
commit af4db5a35a4ef7a68046883bfd12468007db38f1 upstream. A poorly implemented DisplayPort Alt Mode port partner can indicate that its pin assignment capabilities are greater than the maximum value, DP_PIN_ASSIGN_F. In this case, calls to pin_assignment_show will cause a BRK exception due to an out of bounds array access. Prevent for loop in pin_assignment_show from accessing invalid values in pin_assignments by adding DP_PIN_ASSIGN_MAX value in typec_dp.h and using i < DP_PIN_ASSIGN_MAX as a loop condition. Fixes: 0e3bb7d6894d ("usb: typec: Add driver for DisplayPort alternate mode") Cc: stable <stable@kernel.org> Signed-off-by: RD Babiera <rdbabiera@google.com> Reviewed-by: Badhri Jagan Sridharan <badhri@google.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20250618224943.3263103-2-rdbabiera@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/usb/typec_dp.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/usb/typec_dp.h b/include/linux/usb/typec_dp.h
index 8d09c2f0a9b8..c3f08af20295 100644
--- a/include/linux/usb/typec_dp.h
+++ b/include/linux/usb/typec_dp.h
@@ -56,6 +56,7 @@ enum {
DP_PIN_ASSIGN_D,
DP_PIN_ASSIGN_E,
DP_PIN_ASSIGN_F, /* Not supported after v1.0b */
+ DP_PIN_ASSIGN_MAX,
};
/* DisplayPort alt mode specific commands */