Skip to content

Commit eb48954

Browse files
committed
Merge: Updates for powerpc EEH
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4750 Description: Updates for powerpc EEH JIRA: https://issues.redhat.com/browse/RHEL-45149 Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=62627363 Tested: Verified Brew build test kernel RPMs and confirmed issue is resovled Signed-off-by: Mamatha Inamdar <minamdar@redhat.com> commit a1216e6 Author: Ganesh Goudar <ganeshgr@linux.ibm.com> Date: Mon Jun 17 19:32:40 2024 +0530 powerpc/eeh: avoid possible crash when edev->pdev changes If a PCI device is removed during eeh_pe_report_edev(), edev->pdev will change and can cause a crash, hold the PCI rescan/remove lock while taking a copy of edev->pdev->bus. Signed-off-by: Ganesh Goudar <ganeshgr@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20240617140240.580453-1-ganeshgr@linux.ibm.com Signed-off-by: Mamatha Inamdar <minamdar@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents 685b5e6 + 629a9c3 commit eb48954

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/powerpc/kernel/eeh_pe.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe)
849849
{
850850
struct eeh_dev *edev;
851851
struct pci_dev *pdev;
852+
struct pci_bus *bus = NULL;
852853

853854
if (pe->type & EEH_PE_PHB)
854855
return pe->phb->bus;
@@ -859,9 +860,11 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe)
859860

860861
/* Retrieve the parent PCI bus of first (top) PCI device */
861862
edev = list_first_entry_or_null(&pe->edevs, struct eeh_dev, entry);
863+
pci_lock_rescan_remove();
862864
pdev = eeh_dev_to_pci_dev(edev);
863865
if (pdev)
864-
return pdev->bus;
866+
bus = pdev->bus;
867+
pci_unlock_rescan_remove();
865868

866-
return NULL;
869+
return bus;
867870
}

0 commit comments

Comments
 (0)