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-next>] [day] [month] [year] [list]
Message-Id: <20250319134339.3114817-1-ioana.ciornei@nxp.com>
Date: Wed, 19 Mar 2025 15:43:39 +0200
From: Ioana Ciornei <ioana.ciornei@....com>
To: Bjorn Helgaas <bhelgaas@...gle.com>,
	Frank Li <Frank.Li@....com>
Cc: Jingoo Han <jingoohan1@...il.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
	Lorenzo Pieralisi <lpieralisi@...nel.org>,
	kw@...ux.com,
	Rob Herring <robh@...nel.org>,
	linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] PCI: dwc: don't assume the ops field in dw_pcie always exists

The blamed commit assumes that the ops field from dw_pcie is always
populated. This is not the case for the layerscape-pcie driver which
does not provide a dw_pcie_ops structure. The newly added
dw_pcie_parent_bus_offset() function tries to dereference pci->ops
which, in this case, is NULL.

Fix this by first checking if pci->ops is valid before dereferencing it.

Fixes: ed6509230934 ("PCI: dwc: Add dw_pcie_parent_bus_offset() checking and debug")
Signed-off-by: Ioana Ciornei <ioana.ciornei@....com>
---
 drivers/pci/controller/dwc/pcie-designware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
index e68e2aac210f..b5fd44c0d6ad 100644
--- a/drivers/pci/controller/dwc/pcie-designware.c
+++ b/drivers/pci/controller/dwc/pcie-designware.c
@@ -1170,7 +1170,7 @@ resource_size_t dw_pcie_parent_bus_offset(struct dw_pcie *pci,
 
 	of_property_read_reg(np, index, &reg_addr, NULL);
 
-	fixup = pci->ops->cpu_addr_fixup;
+	fixup = pci->ops ? pci->ops->cpu_addr_fixup : 0;
 	if (fixup) {
 		fixup_addr = fixup(pci, cpu_phy_addr);
 		if (reg_addr == fixup_addr) {
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ