summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrishna Kumar <krishnak@linux.ibm.com>2024-07-01 13:15:06 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-09-12 11:12:59 +0200
commitbfc44075b19740d372f989f21dd03168bfda0689 (patch)
treeab789c17cebdff9ed3de92b3ce78cec5d9ab63cd
parent2962197b3e92159d6d8a1d965eedc4016b8fe59e (diff)
downloadlinux-stable-bfc44075b19740d372f989f21dd03168bfda0689.tar.gz
linux-stable-bfc44075b19740d372f989f21dd03168bfda0689.tar.bz2
linux-stable-bfc44075b19740d372f989f21dd03168bfda0689.zip
pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv
[ Upstream commit 335e35b748527f0c06ded9eebb65387f60647fda ] The hotplug driver for powerpc (pci/hotplug/pnv_php.c) causes a kernel crash when we try to hot-unplug/disable the PCIe switch/bridge from the PHB. The crash occurs because although the MSI data structure has been released during disable/hot-unplug path and it has been assigned with NULL, still during unregistration the code was again trying to explicitly disable the MSI which causes the NULL pointer dereference and kernel crash. The patch fixes the check during unregistration path to prevent invoking pci_disable_msi/msix() since its data structure is already freed. Reported-by: Timothy Pearson <tpearson@raptorengineering.com> Closes: https://lore.kernel.org/all/1981605666.2142272.1703742465927.JavaMail.zimbra@raptorengineeringinc.com/ Acked-by: Bjorn Helgaas <bhelgaas@google.com> Tested-by: Shawn Anastasio <sanastasio@raptorengineering.com> Signed-off-by: Krishna Kumar <krishnak@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20240701074513.94873-2-krishnak@linux.ibm.com Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/pci/hotplug/pnv_php.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index 694349be9d0a..573a41869c15 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -40,7 +40,6 @@ static void pnv_php_disable_irq(struct pnv_php_slot *php_slot,
bool disable_device)
{
struct pci_dev *pdev = php_slot->pdev;
- int irq = php_slot->irq;
u16 ctrl;
if (php_slot->irq > 0) {
@@ -59,7 +58,7 @@ static void pnv_php_disable_irq(struct pnv_php_slot *php_slot,
php_slot->wq = NULL;
}
- if (disable_device || irq > 0) {
+ if (disable_device) {
if (pdev->msix_enabled)
pci_disable_msix(pdev);
else if (pdev->msi_enabled)