]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2022 11:04:01 +0000 (13:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2022 11:04:01 +0000 (13:04 +0200)
added patches:
net-emaclite-add-error-handling-for-of_address_to_resource.patch
net-stmmac-dwmac-sun8i-add-missing-of_node_put-in-sun8i_dwmac_register_mdio_mux.patch

queue-4.19/net-emaclite-add-error-handling-for-of_address_to_resource.patch [new file with mode: 0644]
queue-4.19/net-stmmac-dwmac-sun8i-add-missing-of_node_put-in-sun8i_dwmac_register_mdio_mux.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/net-emaclite-add-error-handling-for-of_address_to_resource.patch b/queue-4.19/net-emaclite-add-error-handling-for-of_address_to_resource.patch
new file mode 100644 (file)
index 0000000..8434bf9
--- /dev/null
@@ -0,0 +1,77 @@
+From 7a6bc33ab54923d325d9a1747ec9652c4361ebd1 Mon Sep 17 00:00:00 2001
+From: Shravya Kumbham <shravya.kumbham@xilinx.com>
+Date: Mon, 2 May 2022 12:57:50 +0530
+Subject: net: emaclite: Add error handling for of_address_to_resource()
+
+From: Shravya Kumbham <shravya.kumbham@xilinx.com>
+
+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 <shravya.kumbham@xilinx.com>
+Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -827,10 +827,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.
+@@ -840,8 +840,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);
+@@ -850,6 +856,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;
+       }
+@@ -862,6 +869,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;
+       }
+@@ -874,6 +882,7 @@ static int xemaclite_mdio_setup(struct n
+       bus->parent = dev;
+       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.19/net-stmmac-dwmac-sun8i-add-missing-of_node_put-in-sun8i_dwmac_register_mdio_mux.patch b/queue-4.19/net-stmmac-dwmac-sun8i-add-missing-of_node_put-in-sun8i_dwmac_register_mdio_mux.patch
new file mode 100644 (file)
index 0000000..f34c9b2
--- /dev/null
@@ -0,0 +1,32 @@
+From 1a15267b7be77e0792cf0c7b36ca65c8eb2df0d8 Mon Sep 17 00:00:00 2001
+From: Yang Yingliang <yangyingliang@huawei.com>
+Date: Thu, 28 Apr 2022 17:57:16 +0800
+Subject: net: stmmac: dwmac-sun8i: add missing of_node_put() in sun8i_dwmac_register_mdio_mux()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+commit 1a15267b7be77e0792cf0c7b36ca65c8eb2df0d8 upstream.
+
+The node pointer returned by of_get_child_by_name() with refcount incremented,
+so add of_node_put() after using it.
+
+Fixes: 634db83b8265 ("net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs")
+Reported-by: Hulk Robot <hulkci@huawei.com>
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Link: https://lore.kernel.org/r/20220428095716.540452-1-yangyingliang@huawei.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+@@ -873,6 +873,7 @@ static int sun8i_dwmac_register_mdio_mux
+       ret = mdio_mux_init(priv->device, mdio_mux, mdio_mux_syscon_switch_fn,
+                           &gmac->mux_handle, priv, priv->mii);
++      of_node_put(mdio_mux);
+       return ret;
+ }
index 19bcc367c8831fd41ed9c26b0d9241ed1e4d409e..70252ffafd9f601857246b3122c1f02ffb3ddc4a 100644 (file)
@@ -72,3 +72,5 @@ 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-stmmac-dwmac-sun8i-add-missing-of_node_put-in-sun8i_dwmac_register_mdio_mux.patch
+net-emaclite-add-error-handling-for-of_address_to_resource.patch