From: Sam Bobroff <sbobroff@linux.ibm.com>
Date: Tue, 28 Apr 2020 13:45:05 +1000
Subject: powerpc/eeh: Fix pseries_eeh_configure_bridge()
Patch-mainline: v5.8-rc1
Git-commit: 6fa13640aea7bb0760846981aa2da4245307bd26
References: bsc#1174689
If a device is hot unplgged during EEH recovery, it's possible for the
RTAS call to ibm,configure-pe in pseries_eeh_configure() to return
parameter error (-3), however negative return values are not checked
for and this leads to an infinite loop.
Fix this by correctly bailing out on negative values.
Signed-off-by: Sam Bobroff <sbobroff@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Nathan Lynch <nathanl@linux.ibm.com>
Link: https://lore.kernel.org/r/1b0a6010a647dc915816e44845b64d72066676a7.1588045502.git.sbobroff@linux.ibm.com
Acked-by: Daniel Wagner <dwagner@suse.de>
---
arch/powerpc/platforms/pseries/eeh_pseries.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -605,6 +605,8 @@ static int pseries_eeh_configure_bridge(
if (!ret)
return ret;
+ if (ret < 0)
+ break;
/*
* If RTAS returns a delay value that's above 100ms, cut it
@@ -625,7 +627,11 @@ static int pseries_eeh_configure_bridge(
pr_warn("%s: Unable to configure bridge PHB#%x-PE#%x (%d)\n",
__func__, pe->phb->global_number, pe->addr, ret);
- return ret;
+ /* PAPR defines -3 as "Parameter Error" for this function: */
+ if (ret == -3)
+ return -EINVAL;
+ else
+ return -EIO;
}
/**