Synchronize access to eeh_pe.

Signed-off-by: Sam Bobroff <sbobr...@linux.ibm.com>
---
 arch/powerpc/kernel/eeh.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 171be70b34d8..cba16ca0694a 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -1689,6 +1689,7 @@ int eeh_pe_get_state(struct eeh_pe *pe)
 {
        int result, ret = 0;
        bool rst_active, dma_en, mmio_en;
+       unsigned long flags;
 
        /* Existing PE ? */
        if (!pe)
@@ -1703,10 +1704,14 @@ int eeh_pe_get_state(struct eeh_pe *pe)
         * unavailable so that the error recovery on the guest is suspended
         * until the recovery completes on the host.
         */
+       eeh_lock_pes(&flags);
        if (pe->parent &&
            !(pe->state & EEH_PE_REMOVED) &&
-           (pe->parent->state & (EEH_PE_ISOLATED | EEH_PE_RECOVERING)))
+           (pe->parent->state & (EEH_PE_ISOLATED | EEH_PE_RECOVERING))) {
+               eeh_unlock_pes(flags);
                return EEH_PE_STATE_UNAVAIL;
+       }
+       eeh_unlock_pes(flags);
 
        result = eeh_ops->get_state(pe, NULL);
        rst_active = !!(result & EEH_STATE_RESET_ACTIVE);
-- 
2.22.0.216.g00a2a96fc9

Reply via email to