mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: "open list:THUNDERBOLT DRIVER" <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <Sanju.Mehta@amd.com>,
	Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH v2 2/5] thunderbolt: Do not resume routers if UID is not set
Date: Thu, 3 Mar 2022 07:13:25 -0600	[thread overview]
Message-ID: <20220303131328.4150454-2-mario.limonciello@amd.com> (raw)
In-Reply-To: <20220303131328.4150454-1-mario.limonciello@amd.com>

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>
---
v1->v2:
 * Update commit message
 drivers/thunderbolt/switch.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index b5fb3e76ed09..294518af4ee4 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -2980,6 +2980,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
-- 
2.34.1


  reply	other threads:[~2022-03-03 13:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03 13:13 [PATCH v2 1/5] thunderbolt: Retry DROM reads for more failure scenarios Mario Limonciello
2022-03-03 13:13 ` Mario Limonciello [this message]
2022-03-03 13:13 ` [PATCH v2 3/5] thunderbolt: Do not make DROM read success compulsory Mario Limonciello
2022-03-03 13:13 ` [PATCH v2 4/5] thunderbolt: Clarify register definitions for `tb_cap_plug_events` Mario Limonciello
2022-03-03 13:13 ` [PATCH v2 5/5] thunderbolt: Rename EEPROM handling bits to match USB4 spec Mario Limonciello
2022-03-04 14:17 ` [PATCH v2 1/5] thunderbolt: Retry DROM reads for more failure scenarios Mika Westerberg

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=20220303131328.4150454-2-mario.limonciello@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Sanju.Mehta@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /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

all inboxes | Powered by JetHome®