Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp435790lqa; Sat, 27 Apr 2024 08:09:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUnpoppkC1S02QNoKeTq6dvVd9IE4R/LdQdMy11uWHM6kqjzrtghrdPIETx1tSWu1MPIynKV/XiSviAukhtXED3paTQkdx7U+BtxH4qPQ== X-Google-Smtp-Source: AGHT+IHIa2hy8hWDqkKAEibcUQXLCyjQA9p+QsJ7juv9XjNtn/Tn8TlYXGZ2ox1BY/gZTrHMzb5z X-Received: by 2002:a05:6a00:3a07:b0:6ec:ea4b:f07a with SMTP id fj7-20020a056a003a0700b006ecea4bf07amr6701690pfb.34.1714230588864; Sat, 27 Apr 2024 08:09:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714230588; cv=pass; d=google.com; s=arc-20160816; b=dp1xEGOjm0x0iTmLYuw8gpV+ihxDDaBOzw2qd30mG6sDnXLR3RJ7dFldbEjeMNuBYH JuMhnpGXHBksD/qqFKY5oIB5Fqz1oLl+GUCQX2QjaKDdVZf7pmYMWAHDEbtu7UHtQpMN o3sHdZVEOImLfEGpgs+6NioW7UQfqnjdaoBhaL0gPE3BUwnjdA2bM8csyHcvOLitdgmg CaBIQq9yrPBFcZGvuPNNDthdl8JoTJ/+0hBgmLu5Vc0vy9NixRB6nolY45EK4UXsGI90 kRtRNp9AOxwz5mIuOhEG7sKgTvPtdsMuivFHDclSSE6Vph6uW8FhyxDaN8rHSFQZBaWa SvoA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=UUZD2fJ+H6A+tOSF4mzwykYdNEiaFaYsXsGL/fOpgIE=; fh=7QUY6tNWN3u222+c2W63QIEWtN7pxyATL0zkAGM83iY=; b=W1zRwNPEdhbftlD1+Mp1HaU1aHz9LXf/rNmEit/ybr/qOxOSlgx7HUfnbhvtOkofgu PBsethQLiMKyX66gDfcDKkP6Bxdv67tSTgB5F49Azu48XBFjWjmEsmcj/9r2CL1afUpb gE0GZ1qR+NOEdTX04Qs1XrePVQ9TW6ckkGqS04SfPI81v52fg3SrlZeDHckCL/GbURti kfQ92hSF/NzofGMyWFBHzJaatA2knZJH3uPLAwmP11NgtyMUSmQSaFG1iqd5Z0QxzsDi h2Cg/oTYkOA6JFhl3nzxb+NYOb5i5L03gBntam1Qg0OM6tXayoQtClLroF4A5pHZuUqI MMOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-161082-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161082-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p35-20020a056a000a2300b006ecff4030f9si17191809pfh.326.2024.04.27.08.09.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 08:09:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161082-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-161082-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161082-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7C01828268E for ; Sat, 27 Apr 2024 15:09:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B65294A04; Sat, 27 Apr 2024 15:09:41 +0000 (UTC) Received: from bmailout2.hostsharing.net (bmailout2.hostsharing.net [83.223.78.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A83F010E6; Sat, 27 Apr 2024 15:09:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.223.78.240 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714230581; cv=none; b=COZ+CFX1AySJpYsEkmsioBq/+6kgvOD+gYtVrHQtNGbrUYkXrW5EZN7bPqA4KZ5XPo4G+3ctfDfsry7D7odf56hz0ZOwDcZr6stmo6f+Mj+kBgiTBLjuDpib/OSgbqtiveExsCnbWHtAai/eekwNbVGQ8oOYg5+I/woKRyFUY7Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714230581; c=relaxed/simple; bh=todmIpEhyteA5k+IsTMgSMDRr410TnQF+2voYfCWoaU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KmcomeRdpNCERIAUV9++09hkTRnWLP7tV+I4Ik8HxYm3sYFoflNcLrDbz/HSuLEmc1/aXFVQUYXzOR0WMfY32gWfrrNAGGm80EhNBSTWYk++CsPfAArRxv9o4UPGapaGD+fHoYaSlOQkM8/pQhuo9S3hn48K4FOSthy1yPwTPig= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de; spf=none smtp.mailfrom=h08.hostsharing.net; arc=none smtp.client-ip=83.223.78.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=h08.hostsharing.net Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS RSA CA G1" (verified OK)) by bmailout2.hostsharing.net (Postfix) with ESMTPS id 4B76B280142F3; Sat, 27 Apr 2024 17:09:34 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 4035018B432; Sat, 27 Apr 2024 17:09:34 +0200 (CEST) Date: Sat, 27 Apr 2024 17:09:34 +0200 From: Lukas Wunner To: Esther Shimanovich Cc: Mika Westerberg , Mario Limonciello , Dmitry Torokhov , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Rajat Jain Subject: Re: [PATCH v4] PCI: Relabel JHL6540 on Lenovo X1 Carbon 7,8 Message-ID: References: <20240416050353.GI112498@black.fi.intel.com> <20240419044945.GR112498@black.fi.intel.com> <7d68a112-0f48-46bf-9f6d-d99b88828761@amd.com> <20240423053312.GY112498@black.fi.intel.com> <7197b2ce-f815-48a1-a78e-9e139de796b7@amd.com> <20240424085608.GE112498@black.fi.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Apr 25, 2024 at 05:16:24PM -0400, Esther Shimanovich wrote: > I did find one example of a docking station that uses the DSL6540 > chip, which has PCI IDs defined in include/linux/pci_ids.h: > #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_NHI 0x1577 > #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_BRIDGE 0x1578 > It seems like it has an NHI, despite being in an external, removable > docking station. Could you provide full output of dmesg and lspci -vvv of a machine with this docking station attached? Perhaps open a bug at bugzilla.kernel.org and attach it there? Could you then try the below patch and see if it prevents the Thunderbolt driver from binding to the hot-plugged device? Thanks! -- >8 -- From a10a294a650232c16447a43c2b591f34d3cb399f Mon Sep 17 00:00:00 2001 From: Lukas Wunner Date: Sat, 27 Apr 2024 16:24:18 +0200 Subject: [PATCH] thunderbolt: Do not bind to NHI exposed by a hot-plugged device An NHI should only be exposed by Thunderbolt host controllers, not by hot-plugged devices. Avoid binding to an NHI erroneously or maliciously exposed by a device by looking at the upstream port of its switch: On a host controller, the upstream port is of type TB_TYPE_NHI, whereas on hot-plugged devices it is of type TB_TYPE_PORT. Signed-off-by: Lukas Wunner Cc: stable@vger.kernel.org --- drivers/thunderbolt/tb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index e00e62de53f3..d95ff9ed4d96 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -2786,6 +2786,13 @@ static int tb_start(struct tb *tb, bool reset) if (IS_ERR(tb->root_switch)) return PTR_ERR(tb->root_switch); + /* NHI erroneously exposed by a hot-plugged device? */ + if (!tb_port_is_nhi(tb_upstream_port(tb->root_switch))) { + tb_err(tb, "not a host controller\n"); + tb_switch_put(tb->root_switch); + return -ENODEV; + } + /* * ICM firmware upgrade needs running firmware and in native * mode that is not available so disable firmware upgrade of the -- 2.43.0