Skip to content

Commit

Permalink
thunderbolt: Do not resume routers if UID is not set
Browse files Browse the repository at this point in the history
BugLink: https://bugs.launchpad.net/bugs/1962349

Routers might not have a UID set if the DROM read failed during
initialization previously.

Normally upon resume the UID is re-read to confirm it's the same
device connected.
* If the DROM read failed during init but then succeeded during
  resume it could either be a new device or faulty device
* If the DROM read failed during init and also failed during resume
  it might be a different device plugged in all together.

Detect this situation and prevent re-using the same configuration in
these cirucmstances.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
(cherry picked from commit a283de3 linux-next)
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
  • Loading branch information
Mario Limonciello authored and Timo Aaltonen committed Apr 4, 2022
1 parent ce3950f commit 83bc50d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/thunderbolt/switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -2920,6 +2920,10 @@ int tb_switch_resume(struct tb_switch *sw)
return err;
}

/* We don't have any way to confirm this was the same device */
if (!sw->uid)
return -ENODEV;

if (tb_switch_is_usb4(sw))
err = usb4_switch_read_uid(sw, &uid);
else
Expand Down

0 comments on commit 83bc50d

Please sign in to comment.