[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/3] pci/rcar: Check dw_pcie_host_probe() return value





30.11.2026 13:50, Mykyta Poturai пишет:

Hello Mykyta


dw_pcie_host_probe() returns an ERR_PTR on failure, which was then
passed on to dw_pcie_set_priv().

Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>


Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>

I assume we need a "Fixes:" tag.



Also ...

---
v1->v2:
* new patch
---
  xen/arch/arm/pci/pci-host-rcar4.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/xen/arch/arm/pci/pci-host-rcar4.c 
b/xen/arch/arm/pci/pci-host-rcar4.c
index e1e8eb0ee1..611342f98e 100644
--- a/xen/arch/arm/pci/pci-host-rcar4.c
+++ b/xen/arch/arm/pci/pci-host-rcar4.c
@@ -193,6 +193,11 @@ static int __init pci_host_rcar4_probe(struct 
dt_device_node *dev,
bridge = dw_pcie_host_probe(dev, data, &rcar4_pcie_ops,
                                  &rcar4_pcie_child_ops);
+    if ( IS_ERR(bridge) )

... when looking more closely into what the underlying code can return, I noticed a couple of issues:

1. In dw_pcie_host_probe(), pci_host_common_probe() can return NULL. Since IS_ERR(NULL) is false, dw_pcie_host_probe() misses the failure and dereferences bridge->priv = priv.

2. When ioremap_nocache() fails, dw_pcie_host_probe() returns ERR_PTR(ENXIO) instead of ERR_PTR(-ENXIO). Since IS_ERR(ERR_PTR(ENXIO)) is false, pci_host_rcar4_probe() misses the failure and passes the invalid pointer to dw_pcie_set_priv().

Would you be able to fix those as well, please (ideally in a separate commit on pci-designware.c)? If you would prefer to keep this series focused on R-Car, the pci-designware.c fix could be handled separately.

+    {
+        ret = PTR_ERR(bridge);
+        goto err;
+    }
app_idx = dt_property_match_string(dev, "reg-names", "app");
      if ( app_idx < 0 )





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.