Unverified Commit 38c8fc2f authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!10548 powerpc/eeh: avoid possible crash when edev->pdev changes

parents 61e223aa 5ee1f01f
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -849,6 +849,7 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe)
{
	struct eeh_dev *edev;
	struct pci_dev *pdev;
	struct pci_bus *bus = NULL;

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

	/* Retrieve the parent PCI bus of first (top) PCI device */
	edev = list_first_entry_or_null(&pe->edevs, struct eeh_dev, entry);
	pci_lock_rescan_remove();
	pdev = eeh_dev_to_pci_dev(edev);
	if (pdev)
		return pdev->bus;
		bus = pdev->bus;
	pci_unlock_rescan_remove();

	return NULL;
	return bus;
}