Re: [PATCH] thunderbolt: bound the DROM dual link port number before indexing sw->ports

From: Mika Westerberg

Date: Fri Jun 26 2026 - 05:17:28 EST


Hi,

On Thu, Jun 25, 2026 at 06:54:09AM -0500, Bryam Vargas via B4 Relay wrote:
> From: Bryam Vargas <hexlabsecurity@xxxxxxxxx>
>
> tb_drom_parse_entry_port() validates the device-supplied header->index
> against sw->config.max_port_number before indexing sw->ports[], but the
> sibling field entry->dual_link_port_nr -- a 6-bit value also read from
> the DROM -- indexes the same array with no such check. A malicious or
> malformed Thunderbolt device can set dual_link_port_nr beyond the
> allocated sw->ports[] (max_port_number + 1 entries), producing an
> out-of-bounds tb_port pointer that is stored and later dereferenced.
>
> Reject a port entry whose dual_link_port_nr exceeds max_port_number,
> the same bound already applied to header->index.
>
> Fixes: cd22e73bdf5e ("thunderbolt: Read port configuration from eeprom.")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Bryam Vargas <hexlabsecurity@xxxxxxxxx>

Applied to thunderbolt.git/fixes, thanks!