From: Greg Kroah-Hartman Date: Mon, 9 May 2022 11:03:55 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v4.9.313~66 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b84ffbe66909877b20dfec654fc9e6131bfa18b1;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: net-emaclite-add-error-handling-for-of_address_to_resource.patch --- diff --git a/queue-4.14/net-emaclite-add-error-handling-for-of_address_to_resource.patch b/queue-4.14/net-emaclite-add-error-handling-for-of_address_to_resource.patch new file mode 100644 index 00000000000..54cc7f3d161 --- /dev/null +++ b/queue-4.14/net-emaclite-add-error-handling-for-of_address_to_resource.patch @@ -0,0 +1,77 @@ +From 7a6bc33ab54923d325d9a1747ec9652c4361ebd1 Mon Sep 17 00:00:00 2001 +From: Shravya Kumbham +Date: Mon, 2 May 2022 12:57:50 +0530 +Subject: net: emaclite: Add error handling for of_address_to_resource() + +From: Shravya Kumbham + +commit 7a6bc33ab54923d325d9a1747ec9652c4361ebd1 upstream. + +check the return value of of_address_to_resource() and also add +missing of_node_put() for np and npp nodes. + +Fixes: e0a3bc65448c ("net: emaclite: Support multiple phys connected to one MDIO bus") +Addresses-Coverity: Event check_return value. +Signed-off-by: Shravya Kumbham +Signed-off-by: Radhey Shyam Pandey +Signed-off-by: Paolo Abeni +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/xilinx/xilinx_emaclite.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c ++++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c +@@ -817,10 +817,10 @@ static int xemaclite_mdio_write(struct m + static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) + { + struct mii_bus *bus; +- int rc; + struct resource res; + struct device_node *np = of_get_parent(lp->phy_node); + struct device_node *npp; ++ int rc, ret; + + /* Don't register the MDIO bus if the phy_node or its parent node + * can't be found. +@@ -830,8 +830,14 @@ static int xemaclite_mdio_setup(struct n + return -ENODEV; + } + npp = of_get_parent(np); +- +- of_address_to_resource(npp, 0, &res); ++ ret = of_address_to_resource(npp, 0, &res); ++ of_node_put(npp); ++ if (ret) { ++ dev_err(dev, "%s resource error!\n", ++ dev->of_node->full_name); ++ of_node_put(np); ++ return ret; ++ } + if (lp->ndev->mem_start != res.start) { + struct phy_device *phydev; + phydev = of_phy_find_device(lp->phy_node); +@@ -840,6 +846,7 @@ static int xemaclite_mdio_setup(struct n + "MDIO of the phy is not registered yet\n"); + else + put_device(&phydev->mdio.dev); ++ of_node_put(np); + return 0; + } + +@@ -852,6 +859,7 @@ static int xemaclite_mdio_setup(struct n + bus = mdiobus_alloc(); + if (!bus) { + dev_err(dev, "Failed to allocate mdiobus\n"); ++ of_node_put(np); + return -ENOMEM; + } + +@@ -866,6 +874,7 @@ static int xemaclite_mdio_setup(struct n + lp->mii_bus = bus; + + rc = of_mdiobus_register(bus, np); ++ of_node_put(np); + if (rc) { + dev_err(dev, "Failed to register mdio bus.\n"); + goto err_register; diff --git a/queue-4.14/series b/queue-4.14/series index d813b710e2e..66aa1ae5dd8 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -66,3 +66,4 @@ nfc-nfcmrvl-main-reorder-destructive-operations-in-nfcmrvl_nci_unregister_dev-to nfc-netlink-fix-sleep-in-atomic-bug-when-firmware-download-timeout.patch hwmon-adt7470-fix-warning-on-module-removal.patch asoc-dmaengine-restore-null-prepare_slave_config-callback.patch +net-emaclite-add-error-handling-for-of_address_to_resource.patch