From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6ADA518E77F; Tue, 10 Sep 2024 10:44:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725965090; cv=none; b=s4ufaYLJNL/W65Pw/SC+97INn1TTLHyHTFSSt8eLXECj/ES7DSNBFvQ1ini8wPyU/oGB4jKka0XuFPI44F724iocyddhYUH2/70olwEHxeaIamqrj6kMeu1I/5Cu8kNxIIcta6LeFELEimNB4xi88uN4OINLcTGmldaEqFuFWXc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725965090; c=relaxed/simple; bh=BKTDbhWMBsjkmUm36WqSijsZl7YNH7b6RSO31nKqCHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MIhLFrQhPGvLtmAUhZuA+h4pSs0/vDyPPFMuhzfeLVvCVcljseQChdp8sxGM9BpfJ4QD2lOwO5XabMJ5KFA8PquWrd9rDCYzu0Toiz2U7MbLW4fMr1c1ohWjWL/ERdTs9y3ZPCFkZviynoCsGwQOwjiiyvyXYIB6Ri5tzO9PSaE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=bPfY5wmp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="bPfY5wmp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4FB5C4CEC3; Tue, 10 Sep 2024 10:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725965090; bh=BKTDbhWMBsjkmUm36WqSijsZl7YNH7b6RSO31nKqCHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bPfY5wmpt3H2QTlbUw1nH1hGlqS5HsKnAVHFcjRu5MORG9tC8+ujrnCYg3gW20Fvy TuXZWcO1q3xA4+ip6qxXPh7ws7KWrIjoWOaZcpTfWCPCnRV7rX6EBJc1G91WuRurHi qpchIdm3ZTSYpPXVIUfYQS+fPwA9/E4BYfVDo8Ik= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Timothy Pearson , Bjorn Helgaas , Shawn Anastasio , Krishna Kumar , Michael Ellerman , Sasha Levin Subject: [PATCH 5.10 134/186] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv Date: Tue, 10 Sep 2024 11:33:49 +0200 Message-ID: <20240910092600.107420349@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240910092554.645718780@linuxfoundation.org> References: <20240910092554.645718780@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Krishna Kumar [ 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 Closes: https://lore.kernel.org/all/1981605666.2142272.1703742465927.JavaMail.zimbra@raptorengineeringinc.com/ Acked-by: Bjorn Helgaas Tested-by: Shawn Anastasio Signed-off-by: Krishna Kumar Signed-off-by: Michael Ellerman Link: https://msgid.link/20240701074513.94873-2-krishnak@linux.ibm.com Signed-off-by: Sasha Levin --- 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 04565162a449..cf9c0e75f0be 100644 --- a/drivers/pci/hotplug/pnv_php.c +++ b/drivers/pci/hotplug/pnv_php.c @@ -38,7 +38,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) { @@ -57,7 +56,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.43.0