diff mbox series

[2/4,SRU,Jammy/Unstable/OEM-5.17] thunderbolt: Do not resume routers if UID is not set

Message ID 20220407171739.1176275-3-vicamo.yang@canonical.com
State New
Headers show
Series Bolt doesn't work with native USB4 hosts | expand

Commit Message

You-Sheng Yang April 7, 2022, 5:17 p.m. UTC
From: Mario Limonciello <mario.limonciello@amd.com>

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 a283de3ec646f19b09f3c8e4c8f57c0e017c9b2b linux-next)
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
---
 drivers/thunderbolt/switch.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 13f9230104d7..308f88fb6a30 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -2927,6 +2927,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