From: Krishna Kumar <krishnak@linux.ibm.com>
To: mpe@ellerman.id.au, npiggin@gmail.com
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org, brking@linux.vnet.ibm.com,
gbatra@linux.ibm.com, aneesh.kumar@kernel.org,
christophe.leroy@csgroup.eu, nathanl@linux.ibm.com,
bhelgaas@google.com, oohall@gmail.com,
tpearson@raptorengineering.com, mahesh.salgaonkar@in.ibm.com,
Krishna Kumar <krishnak@linux.ibm.com>
Subject: [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv
Date: Mon, 24 Jun 2024 17:39:27 +0530 [thread overview]
Message-ID: <20240624121052.233232-2-krishnak@linux.ibm.com> (raw)
In-Reply-To: <20240624121052.233232-1-krishnak@linux.ibm.com>
Description of the problem: The hotplug driver for powerpc
(pci/hotplug/pnv_php.c) gives kernel crash when we try to
hot-unplug/disable the PCIe switch/bridge from the PHB.
Root Cause of Crash: The crash is due to the reason that, though the msi
data structure has been released during disable/hot-unplug path and it
has been assigned with NULL, still during unregistartion the code was
again trying to explicitly disable the msi which causes the Null pointer
dereference and kernel crash.
Proposed Fix : The fix is to correct the check during unregistration path
so that the code should not try to invoke pci_disable_msi/msix() if its
data structure is already freed.
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Gaurav Batra <gbatra@linux.ibm.com>
Cc: Nathan Lynch <nathanl@linux.ibm.com>
Cc: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Krishna Kumar <krishnak@linux.ibm.com>
---
drivers/pci/hotplug/pnv_php.c | 3 +--
1 file changed, 1 insertion(+), 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)
--
2.45.0
next prev parent reply other threads:[~2024-06-24 12:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 12:09 [PATCH v3 0/2] PCI hotplug driver fixes Krishna Kumar
2024-06-24 12:09 ` Krishna Kumar [this message]
2024-06-26 15:21 ` [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv Bjorn Helgaas
2024-06-28 5:34 ` Michael Ellerman
2024-06-27 17:08 ` Shawn Anastasio
2024-06-28 4:48 ` Michael Ellerman
2024-06-28 19:22 ` Shawn Anastasio
2024-06-29 7:30 ` Michael Ellerman
2024-06-24 12:09 ` [PATCH v3 2/2] powerpc: hotplug driver bridge support Krishna Kumar
2024-06-27 17:11 ` Shawn Anastasio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240624121052.233232-2-krishnak@linux.ibm.com \
--to=krishnak@linux.ibm.com \
--cc=aneesh.kumar@kernel.org \
--cc=bhelgaas@google.com \
--cc=brking@linux.vnet.ibm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=gbatra@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mahesh.salgaonkar@in.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=nathanl@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=oohall@gmail.com \
--cc=tpearson@raptorengineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox