[PATCH RFC 08/15] powerpc/eeh: Sync eeh_handle_normal_event()

Sam Bobroff sbobroff at linux.ibm.com
Wed Oct 2 16:02:46 AEST 2019


Synchronize access to eeh_pe.

Signed-off-by: Sam Bobroff <sbobroff at linux.ibm.com>
---
 arch/powerpc/kernel/eeh_driver.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index b3245d0cfb22..c9d73070793e 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -879,6 +879,7 @@ static void eeh_clear_slot_attention(struct pci_dev *pdev)
  * & devices under this slot, and then finally restarting the device
  * drivers (which cause a second set of hotplug events to go out to
  * userspace).
+ * Consumes the reference on 'pe'.
  */
 void eeh_handle_normal_event(struct eeh_pe *pe)
 {
@@ -898,6 +899,7 @@ void eeh_handle_normal_event(struct eeh_pe *pe)
 	if (!bus) {
 		pr_err("%s: Cannot find PCI bus for PHB#%x-PE#%x\n",
 			__func__, pe->phb->global_number, pe->addr);
+		eeh_put_pe(pe); /* Release ref */
 		return;
 	}
 
@@ -1141,6 +1143,7 @@ void eeh_handle_normal_event(struct eeh_pe *pe)
 			pci_hp_remove_devices(bus);
 			pci_unlock_rescan_remove();
 			/* The passed PE should no longer be used */
+			eeh_put_pe(pe); /* Release ref */
 			return;
 		}
 	}
@@ -1160,6 +1163,7 @@ void eeh_handle_normal_event(struct eeh_pe *pe)
 	eeh_pe_state_clear(pe, EEH_PE_RECOVERING, true);
 	pr_info("PE state after recovery:\n");
 	eeh_tree_state_dump_kprintf(pe);
+	eeh_put_pe(pe); /* Release ref */
 }
 
 /**
-- 
2.22.0.216.g00a2a96fc9



More information about the Linuxppc-dev mailing list