Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp88481lqh; Fri, 3 May 2024 14:25:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWggDTfnVwM0Y9SvAOB36GFmCdh7XOBTSijIeO2OtXMVb1D16aY0u3XOq/7hzXpGO/MjYxDsUnKmyLpPJ7PklwP9aaF4AR2RHLae+lzwA== X-Google-Smtp-Source: AGHT+IFUWd62g1plnRF7jN1VEZyqb5mhbnR3P2/GAVI3Ob9D1+IEMPTITP4UCBHnArnb6RG5R6Bm X-Received: by 2002:a05:6e02:216b:b0:36b:2438:8805 with SMTP id s11-20020a056e02216b00b0036b24388805mr4785986ilv.12.1714771553722; Fri, 03 May 2024 14:25:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714771553; cv=pass; d=google.com; s=arc-20160816; b=GoJWtRlxA0DxplX+rxYdkAy0nuSRr9qiql3Ui5uoxKGKoSDOxlfB//MaodzysDjsXv jFhX6mi1wsIBjHLldguowmM1A5ECKaZTIDggUrkpKe043Yn2FpS8eOfJSfTMtP9Q3Al4 GBIaoqAhiSXWdHo7e5VEvBqTdFJXxOIM+jlidjxltoUpbmLlnwUZdII60QtGQVlwjakx QQxYQ/oMxHPVLfffzMbN4arH+NSpGdmG/AEbXk8Qid6GkxcrISKLNmA0uNrdNBY7cfzA zhEvRm+CLLXOjz5h65mHlUmXazDvG8CsaZ+y29vHiEqeUD2Uf/3bMpPYAzqpbeFxnok+ YflA== 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:message-id:subject:cc:to:from :date:dkim-signature; bh=FIzdg8NKd+VlSd4mq+rZnvlju6GyvK/vppPQ0PctGqc=; fh=RpjSJzK020Gs7r48hRI4yFF/nIb2oVtbfywWY1PZuzA=; b=F7GgRidCYCaTdGW2IEyb5VnI4llrRJxtkyb9vy81LlhKRR8UMNnBVwtKYXz+Feho+k EDkBddPnK29cqyU0efu9BD+t9aJmqycmeEEIJcQnxLROo0avJfvfgE4HFXBYeJnFlu3e PvnX03uaK95gqG08yo9NVIknEwCrW4T3gIfCmjDMkXAa9rELHpRzF8fWAwW3uUz96CCU dVsu5tQcKywSbM8BJ280X4JSkKAAoT5oR8LBiiYwScrTN7Es8IaXnbmC4I8LnuVOIINr JVndvfgU2sMd+8gwhbOewrHcc9LZZox+fIErmIW9oSu/whLFGsk7w/JALEHNmdggbYXh tSPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jrjrSERt; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-168246-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168246-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b2-20020a637142000000b0061ad115cfedsi2891135pgn.749.2024.05.03.14.25.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:25:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-168246-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jrjrSERt; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-168246-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168246-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C8E36B233C0 for ; Fri, 3 May 2024 21:25:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B56C46441; Fri, 3 May 2024 21:23:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jrjrSERt" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7B0A154277; Fri, 3 May 2024 21:23:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714771423; cv=none; b=QtndpUMXsRBdYv/C3ARvo7G0TlHD2fMa5zt1elCrTbai7IF53xF/1nMHKdGuTXHDijc07YDgWmZdOqO2NdYQLse6Nd6JReMIRtcBtGuxpO+uz+3W5cCwCkyL2GRqED3ipfJ//Bdvf1uKsrmqDthgzZiZ025sen5iSyUvnt5PnXA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714771423; c=relaxed/simple; bh=WuczIjH4tQAgC9Izm+y0x4zUM7SPXPVvm0vjA/Nne4Q=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=qIQWaNGEVuY1oiMueNoLvM44f7+bTE6JLvLxyBv3DtDRODSarDGCPtEGL8nAGEwSRLD12bpOciUMYCpZdujsJ+GioJe6czWcmKGwZsI5Y+QeEk2/S142aspc9cBLkYbx+BIneSrvFrngmBnquRlLcw2lq3BKJW9AQ1EhOTzISeQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jrjrSERt; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C981AC116B1; Fri, 3 May 2024 21:23:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714771423; bh=WuczIjH4tQAgC9Izm+y0x4zUM7SPXPVvm0vjA/Nne4Q=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=jrjrSERtIFlnL87ivY3cR6O8rDFWw9X2Rh/Jqw50aegnY1bChtb/aEGgmiQvRDJuC hXEp+dl4bkLwpfsmsncjLgOPVh5PaY+fwfcVUp9uVUISt7rdTnS+gz4qvN5Ke2UzBh hqCuivJ1ljkbJZE/ZAhFh4zvnF2y6f/biGEIuTl6k2rGjRC4K+pUfHxrtxsIbpdVlK rUmOXRDyNJdD6oC8LdKdnNb+puOKVQSAqvvPzHGEc6sYysweXIYtHVA8KWj0jZ1ZJl IK5tIuOwVMt8ccupK5rVFxYm63BWvHmyGzLElJKPdMFuyxD9esO0BTc7UGkNLMHqsh fZghs4MkwaYdg== Date: Fri, 3 May 2024 16:23:41 -0500 From: Bjorn Helgaas To: Nam Cao Cc: Bjorn Helgaas , Yinghai Lu , Greg Kroah-Hartman , Rajesh Shah , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Lukas Wunner Subject: Re: [PATCH 2/4] PCI: pciehp: bail out if pci_hp_add_bridge() fails Message-ID: <20240503212341.GA1604125@bhelgaas> 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: <401e4044e05d52e4243ca7faa65d5ec8b19526b8.1714762038.git.namcao@linutronix.de> [+cc Lukas] On Fri, May 03, 2024 at 09:23:20PM +0200, Nam Cao wrote: > If there is no bus number available for the downstream bus of the > hot-plugged bridge, pci_hp_add_bridge() will fail. The driver proceeds > regardless, and the kernel crashes. > > Abort if pci_hp_add_bridge() fails. Thanks for this and for the details in the cover letter. The cover letter doesn't get directly preserved and connected to the git commit, so please include some of the details here in the commit log. I don't think we need *everything* from the cover letter; just enough of the messages to show what went wrong and how the kernel crashed, so somebody who trips over this can connect the crash with this fix. And the timestamps are not relevant, so you can strip them out. The qemu repro case is useful too, thanks for that! Same for the shpchp patch. And use "git log --oneline drivers/pci/hotplug/pciehp_pci.c" and match the formatting (in particular, the capitalization) of your subject lines. > Fixes: 0eb3bcfd088e ("[PATCH] pciehp: allow bridged card hotplug") > Signed-off-by: Nam Cao > Cc: Rajesh Shah > Cc: > --- > drivers/pci/hotplug/pciehp_pci.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c > index ad12515a4a12..faf4fcf2fbdf 100644 > --- a/drivers/pci/hotplug/pciehp_pci.c > +++ b/drivers/pci/hotplug/pciehp_pci.c > @@ -58,8 +58,13 @@ int pciehp_configure_device(struct controller *ctrl) > goto out; > } > > - for_each_pci_bridge(dev, parent) > - pci_hp_add_bridge(dev); > + for_each_pci_bridge(dev, parent) { > + if (pci_hp_add_bridge(dev)) { > + pci_stop_and_remove_bus_device(dev); > + ret = -EINVAL; > + goto out; > + } > + } > > pci_assign_unassigned_bridge_resources(bridge); > pcie_bus_configure_settings(parent); > -- > 2.39.2 >