Merge tag 'thunderbolt-for-v7.2-rc7' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-linus

Mika writes:

thunderbolt: Fixes for v7.2-rc7

This includes following USB4/Thunderbolt fixes:

  - Correct DMA unmapping of USB4STREAM driver.
  - Fix indexing of bandwidth groups.
  - More bounds checking for DROM parsing.
  - Fix ICM USB4 router operation messaging.
  - Fix crash on ICM error path.

All these have been in linux-next with no reported issues.

* tag 'thunderbolt-for-v7.2-rc7' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt:
  thunderbolt: Initialize ->domain_released completion before it is being used
  thunderbolt: icm: Preserve USB4 proxy data-valid bit
  thunderbolt: Bound the DROM dual link port number before indexing sw->ports
  thunderbolt: Fix bandwidth group reservation indexing
  thunderbolt: stream: Unmap buffers with mapped size
This commit is contained in:
Greg Kroah-Hartman
2026-08-03 15:59:53 +02:00
5 changed files with 13 additions and 6 deletions

View File

@@ -394,9 +394,16 @@ static int tb_drom_parse_entry_port(struct tb_switch *sw,
return -EIO;
}
port->link_nr = entry->link_nr;
if (entry->has_dual_link_port)
if (entry->has_dual_link_port) {
if (entry->dual_link_port_nr > sw->config.max_port_number) {
tb_sw_warn(sw,
"port entry has invalid dual link port number %u\n",
entry->dual_link_port_nr);
return -EIO;
}
port->dual_link_port =
&port->sw->ports[entry->dual_link_port_nr];
}
}
return 0;
}

View File

@@ -2341,7 +2341,7 @@ static int icm_usb4_switch_op(struct tb_switch *sw, u16 opcode, u32 *metadata,
if (tx_data_len) {
request.data_len_valid |= ICM_USB4_SWITCH_DATA_VALID;
if (tx_data_len < ARRAY_SIZE(request.data))
request.data_len_valid =
request.data_len_valid |=
tx_data_len & ICM_USB4_SWITCH_DATA_LEN_MASK;
memcpy(request.data, tx_data, tx_data_len * sizeof(u32));
}

View File

@@ -1226,6 +1226,8 @@ int nhi_probe(struct tb_nhi *nhi)
return dev_err_probe(dev, res, "NHI specific init failed\n");
}
init_completion(&nhi->domain_released);
tb = nhi_select_cm(nhi);
if (!tb)
return dev_err_probe(dev, -ENODEV,
@@ -1233,8 +1235,6 @@ int nhi_probe(struct tb_nhi *nhi)
dev_dbg(dev, "NHI initialized, starting thunderbolt\n");
init_completion(&nhi->domain_released);
res = tb_domain_add(tb, host_reset);
if (res) {
/*

View File

@@ -257,7 +257,7 @@ static void tbstream_ring_free(struct tbstream_ring *ring)
if (sf->frame.buffer_phy)
dma_unmap_page(dma_dev, sf->frame.buffer_phy,
tb_ring_frame_size(&sf->frame), dir);
TB_MAX_FRAME_SIZE, dir);
sf->frame.buffer_phy = 0;
if (sf->page)
__free_page(sf->page);

View File

@@ -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;