lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250225171239.19574-2-manivannan.sadhasivam@linaro.org>
Date: Tue, 25 Feb 2025 22:42:38 +0530
From: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
To: jingoohan1@...il.com,
	lpieralisi@...nel.org,
	kw@...ux.com
Cc: robh@...nel.org,
	bhelgaas@...gle.com,
	linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	shradha.t@...sung.com,
	cassel@...nel.org,
	Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Subject: [PATCH 1/2] PCI: dwc-debugfs: Perform deinit only when the debugfs is initialized

Some endpoint controller drivers like pcie-qcom-ep, pcie-tegra194 call
dw_pcie_ep_cleanup() to cleanup the resources at the start of the PERST#
deassert (due to refclk dependency). By that time, debugfs won't be
registered, leading to NULL pointer dereference:

Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
Call trace:
dwc_pcie_debugfs_deinit+0x18/0x38 (P)
dw_pcie_ep_cleanup+0x2c/0x50
qcom_pcie_ep_perst_irq_thread+0x278/0x5e8

So perform deinit only when the debugfs is initialized.

Fixes: 24c117c60658 ("PCI: dwc: Add debugfs based Silicon Debug support for DWC")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
---
 drivers/pci/controller/dwc/pcie-designware-debugfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-designware-debugfs.c b/drivers/pci/controller/dwc/pcie-designware-debugfs.c
index dca1e9999113..9ff4d45e80f1 100644
--- a/drivers/pci/controller/dwc/pcie-designware-debugfs.c
+++ b/drivers/pci/controller/dwc/pcie-designware-debugfs.c
@@ -535,6 +535,9 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir)
 
 void dwc_pcie_debugfs_deinit(struct dw_pcie *pci)
 {
+	if (!pci->debugfs)
+		return;
+
 	dwc_pcie_rasdes_debugfs_deinit(pci);
 	debugfs_remove_recursive(pci->debugfs->debug_dir);
 }
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ