Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4689768pxj; Wed, 12 May 2021 10:57:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzH0mppk06jI1Z8u6LTYQ6uUDea9tUIbLISGd+MVJuMreQNdBQ8bqdZq45zD6CGqh9dseRH X-Received: by 2002:a17:906:2cce:: with SMTP id r14mr24505344ejr.38.1620842277472; Wed, 12 May 2021 10:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620842277; cv=none; d=google.com; s=arc-20160816; b=BGqj/JBF5EGEERH3IlnWpmSyLIPfXPfOi0UqrInBjph8ycHjnL/DqYMiAbDYyKOKDl Lf1pNW6A6BSLOjKSF4ALF7dWb4HfvS7GZAQCpsVrXFktqw9t8qQj9D6+EgEMUfcJHVWL lUzaktqxyxt7TpZUBI2nbebpqwXbC89gtFWsEV0ssjt5SrMbEY66M1xAaZwZ8YT4SdD6 lX/lla11lE85DgJoNz5PW5jgjXnneBFqDLC2yHByyXA5H7IrjkMIOQp2eIr9rMjzxf5/ oygDQg7U2FTGBhjQeFrPp9kAtkE1WxPmXNSHTLYpgELdAJ9dKJNZH6728CmbXOjO3Rd+ Z+Hw== 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=V/sNxVvoPXcRV3xxoFVJI3ISQKMz9v4hGzm200mOfiyDStvt6Du4uf8KgebxPvzAdR vsgVvj62JJ8jdLhAMuwRRHKcT8e918QQOPQnJKIsse3kvBNvfCUPiyBSkPjhSBa9wNZP AfKXXtcqivIMI7vE+5HFNc0Ei61f+OpNHbYxiVCx2dZbgu1UrSKS0ZtHJt1ffhqh0lUx LMF0AbS2SAK+mqV5h5ZqkSbVHMVkbynZmGMlfavcQOB2p0tz0mxATLPgq174mT5u6wrE WxhSG6AZOic7Lkw7rgsLs6/NO7EzN1w3qeUT0TqdyqVco6tJQWLxCDs1PayYOcj5eI1r IjNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xaN4ryqR; 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 n15si353696edy.288.2021.05.12.10.57.27; Wed, 12 May 2021 10:57:57 -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=xaN4ryqR; 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 S1351014AbhELRxC (ORCPT + 99 others); Wed, 12 May 2021 13:53:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:60246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236775AbhELQXE (ORCPT ); Wed, 12 May 2021 12:23:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D6FE261C9E; Wed, 12 May 2021 15:47:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620834444; bh=Yi7a76Xqz2dyROR/LuHq02uv2UfJ5IpCohE1rMnHwTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xaN4ryqRwdiUA3G6KSqiysdKPLHKU4n4tPlaQ9KiDvy9Er1xCmsdB9Ws+ewQN7K/H rTbB6rZv7LyKrGQKW1RQ52pbeMds1yLbL3/G2Qf1XLFBxau5VgC3E06j+TNgEaam6k JjnECpQSWwS3zIBQzQSkdlLCt8UectBQqxebnwfw= 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.11 519/601] powerpc/pseries: extract host bridge from pci_bus prior to bus removal Date: Wed, 12 May 2021 16:49:56 +0200 Message-Id: <20210512144844.948197485@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144827.811958675@linuxfoundation.org> References: <20210512144827.811958675@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