Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp619844pxj; Thu, 20 May 2021 18:06:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwo1+7A0/q0LAvQCFee/1f6lbCGVFJmHJK0uBqkdJoqZZhe0tC3jHRxfbguBcKSfutIKEfF X-Received: by 2002:a05:6402:337:: with SMTP id q23mr7752555edw.215.1621559218913; Thu, 20 May 2021 18:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621559218; cv=none; d=google.com; s=arc-20160816; b=y8Ug5p67tJyM+t9STnthX8+zalTnEkahw3EOMbNvZA1fjzq5KaI2yU9tAT4TdtARF0 9jAmjr9JByzxslOnBSl8E82Ur6YkwFHpxC5mIljfd6DWoNvf/D5356GGvSwvd5kBGvrM RHaA/J+dVBXeMExFdFLG06vsnFgaOYwPwZVcH4sxqLV4+QnTih/EZp2Y0Y7R5LP/0nXC /5TwBaiId1YIURgZQI87ir5ky/yMVA5H80KT0o25G5/iJtlV2Sp6aTYwkFB3/p6LDffl pn/55mPPsTY4oDMrrNYuFrEzsvTO7q9Rk0VBQK0UIZwo18HByoGHm4K8Ku12mICKDGFs hNXg== 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=jwGnmwS02roPBizY3uhJehklX9Uc0glEQawMn7DnrHU=; b=AmuOfdZgi7LhA0nS2fCH6fcNaOvlWkL43tiX0FTSwBCIYuLvTmnuzA1EQgWbBVucDx Lci0xQCkZyN0Jfl42cJsN/JPYuxU2BrjA746+Edh+V5ZMeNBGkABc+MlBR4y4y2PwWsV OlppdHfSC4vSt1FrlgXJY7ucpS5CKuJc1m9kenY8Zl+CHhpSK2HrslC6JbWGacUUSRGg vdDHf3uQdmRC5xFkNHMuS7C1vpKbukzFVHWIbOs31lhd8hrbasBmPlVk1iwgRsW/J9+U mF/j3i+o3dae7osR3k6V7dYzSwXC8I1voYDgRtJuxmJD1xzbgtUrxhvFLrDacylrZuFF /Hww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rEmDh1o8; 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 e6si4140125edz.503.2021.05.20.18.06.35; Thu, 20 May 2021 18:06:58 -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=rEmDh1o8; 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 S241339AbhETLjC (ORCPT + 99 others); Thu, 20 May 2021 07:39:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:41740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240631AbhETLTC (ORCPT ); Thu, 20 May 2021 07:19:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9CB6C61D6C; Thu, 20 May 2021 10:10:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505413; bh=7UjLbQXIo6n25bLAAf82HRbsyvDIXvpVV1MpmJiGtA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rEmDh1o8wx3dUf379EA9HvZKPdnCRPmr2xIszoy507cDxN7wanjSSgv6+c/7utdxm 9/ZTZGrGUB4HIRGoNe7pXt//a0CFl57sPkcVm4XEGgEHwAJjuedPYRHZaCoomo8htV lGr5qV+Csz4Ckda7TmPz6Dc0HP47NDU1/E5ecZgE= 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 4.4 124/190] powerpc/pseries: extract host bridge from pci_bus prior to bus removal Date: Thu, 20 May 2021 11:23:08 +0200 Message-Id: <20210520092106.302333187@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 5d4a3df59d0c..baaeb753fa79 100644 --- a/arch/powerpc/platforms/pseries/pci_dlpar.c +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c @@ -98,6 +98,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; @@ -124,7 +125,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