Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp640006pxm; Thu, 3 Mar 2022 01:21:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkWXZc+dgsi5pLADlRVdJ/oMB5eChdXD+VokDDyRr4m6MunVOraOzawOIRFat+CtWQragb X-Received: by 2002:a05:6402:50ca:b0:413:2a27:6b63 with SMTP id h10-20020a05640250ca00b004132a276b63mr33218595edb.349.1646299266740; Thu, 03 Mar 2022 01:21:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646299266; cv=none; d=google.com; s=arc-20160816; b=OCefrZ4IDndl3B4bDWCqrDv7yjlx9UQ17CmdIuzGbtomVzN20A3dY1B4//emtG2GHW mJ+hlywdpLbbYVxF7nR/FeISkdOtHUzreqW6Pb2vnvYo038w6voM+4Xq5tlb5+TTwt/P 9zQRuMSmOBqGZiKlQGdm6CmrJfWEDdh5qaoYxcIzz/PK/9IJ0mapXYSCaaKSao4T4REo 6dOwe6Yug7XYOL/tbfy1AV5djMe4OYVSptguVbzClIrVEpiQn0lVHTjtpc4aAL1xbWg8 LE71R8lGnWAfUtFNON7neSlfiypxUIdHxhz+LTTDVuwUtLz60zhVSW16LG+zRRZyO3JG cfwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=SY+UhgSaAeFqgXhl8Ci+4W9SGkEGsEwxFQNvK0b8aCI=; b=X8CJyP3z54sV9dhJJ5eUE6EewoJySfFCQeLxWflISp8aRaqWHGiT3bgIUKrOK5tnw/ f809ouzb0OcwvkLatllYaLglg6sWZjtQx3OG6YnDDJmhw3rUrtoeUAf5ALvJGbAIbjij 8rthz9IJOgtT8/APvECBb3x24mSZbw7SEHvQ4cxNnfJt+fdjE7FpOw23PvgRVQpgFQ7Z 34sPKs0DhDadc11EtqPQQbZR6ag4n72r2ufprfF4frPk60cWZXjrtzNCM1JIP1LOySO3 tWDzFOXW1U5S2bFo3zgIZf2Kr+7SPnlpUix2pV3zQeaMJN0AqZBoOmuMl6sIbNIWD+cZ 8UrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=M+p7vCVk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e26-20020a170906315a00b006d09df5bf2asi855931eje.309.2022.03.03.01.20.44; Thu, 03 Mar 2022 01:21:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=M+p7vCVk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230290AbiCCHo3 (ORCPT + 99 others); Thu, 3 Mar 2022 02:44:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbiCCHo2 (ORCPT ); Thu, 3 Mar 2022 02:44:28 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 936B015C9ED; Wed, 2 Mar 2022 23:43:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646293423; x=1677829423; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=uFbDZllnjgFcPHD9kmqzGdMepkMXyq0m/mHoU/oLtz0=; b=M+p7vCVkJ+MJx45rqoNhHJJK8DV5Xh11er0XPuG/L4Z54rawI/IMDBfM 3ZTGGeI+8CHcRwthPig3q1bimjR8YO9R113Lc1AZMFhlQbF7mm3yKga0F mK8XpOMGoC09GtX9CQ6ir/+rc5Qm/APjSMVCgnu6TSipnN6VAXizAbEWm Ay9ot2+DTaCVVc7oHRmMUw+APi4O8RdqoOEBfasXLKtkqhs6WeWmGksdc PEpGyt2hpeZBf49zFCITIcEJBLnVPA+f5J97WXNtkVT3x/dIyZPU4oPXF g42z9HzIQAChaAveAbgDmdnULOl8sk9ZGBzb9tqORmT0BIYdBzCC/9Nlp w==; X-IronPort-AV: E=McAfee;i="6200,9189,10274"; a="340035954" X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="340035954" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2022 23:43:43 -0800 X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="779158794" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.162]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2022 23:43:41 -0800 Received: by lahna (sSMTP sendmail emulation); Thu, 03 Mar 2022 09:43:38 +0200 Date: Thu, 3 Mar 2022 09:43:38 +0200 From: Mika Westerberg To: Mario Limonciello Cc: "open list:THUNDERBOLT DRIVER" , linux-kernel@vger.kernel.org, Sanju.Mehta@amd.com Subject: Re: [PATCH 2/5] drivers/thunderbolt: don't resume switches without uid set Message-ID: References: <20220302220709.3138846-1-mario.limonciello@amd.com> <20220302220709.3138846-2-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220302220709.3138846-2-mario.limonciello@amd.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mario, On Wed, Mar 02, 2022 at 04:07:06PM -0600, Mario Limonciello wrote: > Switches might not have a uid set if the DROM read failed during That's "Routers" and "UID" :) Also $subject should have prefix "thunderbolt: " not "drivers/thunderbolt". Please capitalize the summary too: thunderbolt: Do not resume routers if UID is not set The patch itself looks good to me. > 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 > --- > 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