Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4631199pxj; Wed, 12 May 2021 09:37:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRzJgEP48QulqwRc8uheGrhx4kzjLc/1A8JUJIfusMoJLrde+2sZYigHRX0ycaWEfr7rF5 X-Received: by 2002:a17:906:a2d1:: with SMTP id by17mr40094724ejb.426.1620837465950; Wed, 12 May 2021 09:37:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837465; cv=none; d=google.com; s=arc-20160816; b=YjG/3c5PwwpbGwB3kqFWhNc9KQ6xGJ7KW4e3yKXjFf4r+DLxCOas1tZXq0ALpNu/Rp dy7MHtOepUGJhjePG1MYALNgswwxKFlk5teCeEftnPHct/Wql0JTJNWNsPrJXhauSbEz 2g+xcQ5fZPF4SYFpH5rnT3632EKKHFMO5C8n347zMpdcWKit4p/7xa+O1sR4rQdR+Z9a 80m/c76Lso1xRANOsY5vlglSi2FS02RCFAYdm+/7jPoNmOlc5onuSfg8IRkEm+kl+jaE OXt/i/W/WQH3OgXzCz/lnfZ7ivJukJvg5a0JHM3k/VQEwra5TQDUmN2ANsmFNhHouLP1 HdOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pbl6/PSgYIP1uC4LU18JCvedV4LO4sLekY7dl9y10Q0=; b=m8cpCrmk46zjHIRXsDqX3PvwNCkxMWx9gcbEni6StXf9rOp2+bzwQ8BG6uuvgjrrVk qwUy4bWSUTXd5xUi7PysmEXrYVx70HDvBbPTfLE8BNm9Zp79LCqesHtf55TKOqfLqRa/ yeTxE3cjUuM6HwgUbGC4JeVrBkMamhdwVt61kyKv3/aEjDBzKf5oSe9z9jdtNqjh3Ma1 Dzbr2agRIxEv4e1oFzqG5RxVF2zWnyLMwEWel7WBnlNJFEhrtNVsawVo37lRKuBRgILj trnT4w0FJoJPysblEl+PFKw66Np1pbq0t//GNGe+AvBg2ajxy0RrrI3CGQ1dmEAeKniF nqtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WdmxaWmk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id af15si382740ejc.400.2021.05.12.09.37.20; Wed, 12 May 2021 09:37:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WdmxaWmk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242055AbhELQbo (ORCPT + 99 others); Wed, 12 May 2021 12:31:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:56846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236145AbhELPkW (ORCPT ); Wed, 12 May 2021 11:40:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7F6C861C78; Wed, 12 May 2021 15:21:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832864; bh=Yi7a76Xqz2dyROR/LuHq02uv2UfJ5IpCohE1rMnHwTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WdmxaWmk6DFXiUfE3MGzvJF00XiUVRNtG2BPYinmsmuZvMTFNlV3a9Y1Vl5tBhv9U qq1unlmkqtG+UsAeO1K/841NJAj7adVDUJOcFwLyvpGvs9ujkynCdxnvEyv0mDsMjz ZHWj94CCVbG4tUeYtKXvbPWq10OTeHYrGoQ2xI68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tyrel Datwyler , Michael Ellerman , Sasha Levin Subject: [PATCH 5.10 455/530] powerpc/pseries: extract host bridge from pci_bus prior to bus removal Date: Wed, 12 May 2021 16:49:25 +0200 Message-Id: <20210512144834.720456485@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tyrel Datwyler [ Upstream commit 38d0b1c9cec71e6d0f3bddef0bbce41d05a3e796 ] The pci_bus->bridge reference may no longer be valid after pci_bus_remove() resulting in passing a bad value to device_unregister() for the associated bridge device. Store the host_bridge reference in a separate variable prior to pci_bus_remove(). Fixes: 7340056567e3 ("powerpc/pci: Reorder pci bus/bridge unregistration during PHB removal") Signed-off-by: Tyrel Datwyler Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20210211182435.47968-1-tyreld@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/platforms/pseries/pci_dlpar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c index f9ae17e8a0f4..a8f9140a24fa 100644 --- a/arch/powerpc/platforms/pseries/pci_dlpar.c +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c @@ -50,6 +50,7 @@ EXPORT_SYMBOL_GPL(init_phb_dynamic); int remove_phb_dynamic(struct pci_controller *phb) { struct pci_bus *b = phb->bus; + struct pci_host_bridge *host_bridge = to_pci_host_bridge(b->bridge); struct resource *res; int rc, i; @@ -76,7 +77,8 @@ int remove_phb_dynamic(struct pci_controller *phb) /* Remove the PCI bus and unregister the bridge device from sysfs */ phb->bus = NULL; pci_remove_bus(b); - device_unregister(b->bridge); + host_bridge->bus = NULL; + device_unregister(&host_bridge->dev); /* Now release the IO resource */ if (res->flags & IORESOURCE_IO) -- 2.30.2