From: sashiko-bot@kernel.org
To: "Mario Limonciello" <mario.limonciello@amd.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] thunderbolt: Always generate the host router UUID
Date: Thu, 03 Dec 2026 18:37:16 +0000 [thread overview]
Message-ID: <sashiko-outbox-248403@kernel.org> (raw)
In-Reply-To: <20261203-thunderbolt-v1-1-347b359ad963@amd.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] thunderbolt: tb_switch_set_uuid() randomizes ICM host router
UUIDs
- [Medium] thunderbolt: random host UUID breaks ICM NVM auth status
cache and PM
- [Medium] thunderbolt: random host sw->uuid breaks unique_id ABI and
tbnet MACs
--
commit a31a94f0079a9a603cbe4c84d45d8948d7a02f23
Author: Mario Limonciello <mario.limonciello@amd.com>
thunderbolt: Always generate the host router UUID
This commit changes tb_switch_set_uuid() to generate a random UUID for host
routers instead of deriving it from the router UID or link controller
registers, while keeping the existing derivation for device routers.
> diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
> index 8899fea713ac2..6cedaf5351bd9 100644
> --- a/drivers/thunderbolt/switch.c
> +++ b/drivers/thunderbolt/switch.c
> @@ -2872,7 +2872,17 @@ static int tb_switch_set_uuid(struct tb_switch *sw)
> if (sw->uuid)
> return 0;
>
> - if (tb_switch_is_usb4(sw)) {
> + if (!tb_route(sw)) {
> + /*
> + * USB4 spec requires the Domain UUID to be generated
> + * according to ISO/IEC 9834-8 so never derive it from the
> + * host router UID. The UID is not guaranteed to be unique
> + * either (it can be left unprogrammed) and if two hosts end
> + * up with the same UUID the inter-domain link is mistaken
> + * for a loop and lanes are never bonded.
> + */
> + generate_random_uuid((u8 *)uuid);
> + } else if (tb_switch_is_usb4(sw)) {
[Severity: High]
Does this randomize sw->uuid on ICM host routers where icm->set_uuid is
NULL?
On Falcon Ridge, Alpine Ridge, Titan Ridge, and Maple Ridge controllers,
icm_start() calls tb_switch_add() with sw->uuid unset, so
tb_switch_set_uuid() now generates a new UUID on every probe and power
cycle.
When host NVM authentication fails in nvm_authenticate_host_dma_port(),
nvm_set_auth_status() caches the failure under sw->uuid before power
cycling. After re-probe with a new UUID, nvm_get_auth_status() in
tb_switch_add_dma_port() misses the cache and skips post_nvm_auth().
That permanently leaks the PCIe root port runtime PM reference taken by
nhi_pci_start_dma_port(), hides the failure status in nvm_authenticate,
and leaks the nvm_auth_status_cache entry.
Under ICM, tb_xdp_handle_request() also answers XDomain UUID_REQUEST with
tb->root_switch->uuid, which now disagrees with firmware's xd->local_uuid
and makes tb_xdp_properties_response() return ERROR_UNKNOWN_DOMAIN.
Guarding this branch with !tb_switch_is_icm(sw) avoids affecting ICM.
[Severity: Medium]
Can generating a fresh random sw->uuid across power cycles break
__nvm_get_auth_status() lookups on ICM host routers?
__nvm_get_auth_status() keys nvm_auth_status_cache by sw->uuid, so both
immediate and deferred host NVM authentication failures lose their cached
status after dma_port_power_cycle() re-enumerates the router with a new
UUID.
This leaves nvm_authenticate_show() reporting 0x0, leaks the cached
nvm_auth_status entry, and leaks the PCIe root port runtime PM reference
from nhi_pci_start_dma_port(). Storing the software connection manager
Domain UUID separately on struct tb would avoid touching ICM host UUIDs.
[Severity: Medium]
Should the random Domain UUID be kept separate from sw->uuid so host
router unique_id and thunderbolt-net MAC addresses stay stable across
boots?
unique_id_show() exposes sw->uuid directly as
/sys/bus/thunderbolt/devices/<domain>-0/unique_id, which now changes on
every boot and driver reload. That contradicts
Documentation/ABI/testing/sysfs-bus-thunderbolt, which documents unique_id
as hardware-register or DROM/UID derived and is not updated here.
In addition, tb_scan_xdomain() copies tb->root_switch->uuid into
xd->local_uuid, and tbnet_generate_mac() hashes it for the thunderbolt-net
MAC address. Randomizing sw->uuid causes those MAC addresses to change on
every boot, breaking persistent MAC-based network configuration.
Because only tb_scan_xdomain() and tb_xdp_handle_request() use the host
Domain UUID for inter-domain traffic, storing a dedicated Domain UUID on
struct tb would preserve both the documented unique_id ABI and stable
thunderbolt-net MACs.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-thunderbolt-v1-1-347b359ad963@amd.com?part=1
prev parent reply other threads:[~2026-12-03 18:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 17:18 [PATCH] thunderbolt: Always generate the host router UUID Mario Limonciello
2026-12-03 18:37 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-248403@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox