summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXu Rao <raoxu@uniontech.com>2026-06-24 14:27:03 +0800
committerMika Westerberg <mika.westerberg@linux.intel.com>2026-07-27 11:58:54 +0200
commitd2ee4d47aacbd2ba456092eeec670dba35fde291 (patch)
tree2dbeaec36f5eed0d2616bab389cf755eff2587c9
parent97b228e596740fca5eeeb1d8e619c1f457d7e2f0 (diff)
downloadlinux-next-d2ee4d47aacbd2ba456092eeec670dba35fde291.tar.gz
linux-next-d2ee4d47aacbd2ba456092eeec670dba35fde291.zip
thunderbolt: Fix bandwidth group reservation indexing
Valid bandwidth group IDs range from 1 through MAX_GROUPS, while Group ID 0 is reserved. tb_consumed_dp_bandwidth() uses the Group ID directly to index its local group_reserved[] array. The array currently has MAX_GROUPS entries, so its valid indices are 0 through MAX_GROUPS - 1. Group ID MAX_GROUPS therefore accesses one element past the end, and the final group's reserved bandwidth is not included when the array is summed. Give group_reserved[] MAX_GROUPS + 1 entries so direct Group ID indexing covers the reserved ID 0 and valid IDs 1 through MAX_GROUPS. Fixes: 52a4490e89d7 ("thunderbolt: Reserve released DisplayPort bandwidth for a group for 10 seconds") Cc: stable@vger.kernel.org Signed-off-by: Xu Rao <raoxu@uniontech.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r--drivers/thunderbolt/tb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index 76323255439a..f43f2d952372 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -609,7 +609,7 @@ static int tb_consumed_dp_bandwidth(struct tb *tb,
int *consumed_up,
int *consumed_down)
{
- int group_reserved[MAX_GROUPS] = {};
+ int group_reserved[MAX_GROUPS + 1] = {};
struct tb_cm *tcm = tb_priv(tb);
struct tb_tunnel *tunnel;
bool downstream;