Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2366564pxb; Thu, 11 Feb 2021 10:29:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvwEoCoUtQjtnfVuHT2rnBE47IDZhBYwTfmmMq2nB/kS6TlLhihBrZCgIIqmgiq5ghNjD1 X-Received: by 2002:aa7:c685:: with SMTP id n5mr9987936edq.150.1613068151619; Thu, 11 Feb 2021 10:29:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613068151; cv=none; d=google.com; s=arc-20160816; b=dFekBDUfPNpSROYnRmq7ni2cvcVLEBuBKyu9lf+emBsCQt6slN2updekzZNOAmovZh OkcIcd5BHr1Ro3QHvt5mkAdQ/XOS8iBFhm0+SAJ1VD/Gped5BROsyrzNjqhDhOhBLFeh B/0/KvSbIz4tyt9hBmPtOWMk7KsbPnqG17gihjL+XejIMB9AiO9HECi8RTmaiJ+YvwUb RBIuXVsoAsiSjYzGQcBeb35GxXvXwnM4obYRn5CKGRseQh3QOyede6s3rxuUQJPi69Jd 7Fcqt3+4YEzSot6QmjUWmPSbKUYK+ALI8Yviub1lXNEkm3jcpxDcAFTSblyqFOCEVPLH g3fA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=oIZ+lPlDFHFlYt3NSZHQHMGhlRDULbD9iz67e98jvbE=; b=mFpk1EzMzz2mlJbdPzmg7tszpu13BKOVUoAkBsoH3DmXu1o/3xWjEecNO7ChVO6amK 1J7uTUorP2u38MTEaW8kyY7OESYP74M9keRSsueganOYGandsvvXpQSC4E71OeKPnJvS VrV/XGQ3Xn0dlsWztyXPp/bKLcNqmsS32pg5pzuRnsIxPYvS9ay7gNB19vJ2+NJNv/LV DrxYMTcVZMxd4Y4UoOvKNu5lRZZSoIQXiSquWxLvnR2wfqyxlUXfkkbyWet5F5Ph6oAF NR7Xd7+1g+qpciWpVppExLWJN9ziAKrHZOulAtfU9mq2FmhcAQALXYMAJPixamxUeESD 582A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=hDwf0NXB; 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q3si4214176ejx.656.2021.02.11.10.28.43; Thu, 11 Feb 2021 10:29:11 -0800 (PST) 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=@ibm.com header.s=pp1 header.b=hDwf0NXB; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232704AbhBKS1i (ORCPT + 99 others); Thu, 11 Feb 2021 13:27:38 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:53510 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232701AbhBKSZp (ORCPT ); Thu, 11 Feb 2021 13:25:45 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 11BIOF9S006112; Thu, 11 Feb 2021 13:24:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=oIZ+lPlDFHFlYt3NSZHQHMGhlRDULbD9iz67e98jvbE=; b=hDwf0NXByq4HoOCn78MNsTl3h2gn2z7MdczP374aL1X3vRJw5dymCIt0S5sNw8u9jUBx dFr+cS1pFmGZVWjAqR5aVATRzX/3QNxT0UT1HcegkgJ8LJnMsaYWr9gMwU+GsDH0SkH9 jLQ97JvsVZgf06oOqsHBZNjf83RYpnWJ8nAqIswCAPxYHl+XbF2q6PKYCaUJKDcDudHj nPGZ8u4OIXDndcVxh/xSQttZzZiNhIKFkdURMI1sOHM/EMswH06ekU3bXLqRNwm3GEBd GcSBIuCERSWeXjvq4z1j+py5g28MhnmakKAu8muR2nfiAm4P4/NORbWFGxv5J1Gjm8jE Sw== Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com with ESMTP id 36n9u20077-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Feb 2021 13:24:39 -0500 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 11BIBULr020565; Thu, 11 Feb 2021 18:24:39 GMT Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by ppma04dal.us.ibm.com with ESMTP id 36hjra1gp6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Feb 2021 18:24:39 +0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 11BIOb4m26870194 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Feb 2021 18:24:37 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9CF196E04C; Thu, 11 Feb 2021 18:24:37 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 58F626E04E; Thu, 11 Feb 2021 18:24:37 +0000 (GMT) Received: from vios4361.aus.stglabs.ibm.com (unknown [9.3.43.61]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Thu, 11 Feb 2021 18:24:37 +0000 (GMT) From: Tyrel Datwyler To: mpe@ellerman.id.au Cc: benh@kernel.crashing.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Tyrel Datwyler Subject: [PATCH] powerpc/pseries: extract host bridge from pci_bus prior to bus removal Date: Thu, 11 Feb 2021 12:24:35 -0600 Message-Id: <20210211182435.47968-1-tyreld@linux.ibm.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.737 definitions=2021-02-11_07:2021-02-11,2021-02-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 mlxlogscore=997 clxscore=1015 priorityscore=1501 impostorscore=0 malwarescore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102110144 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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.27.0