]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Nov 2021 18:19:44 +0000 (19:19 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Nov 2021 18:19:44 +0000 (19:19 +0100)
added patches:
net-mdio-mux-fix-unbalanced-put_device.patch

queue-4.9/net-mdio-mux-fix-unbalanced-put_device.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/net-mdio-mux-fix-unbalanced-put_device.patch b/queue-4.9/net-mdio-mux-fix-unbalanced-put_device.patch
new file mode 100644 (file)
index 0000000..1a960cf
--- /dev/null
@@ -0,0 +1,55 @@
+From 60f786525032432af1b7d9b8935cb12936244ccd Mon Sep 17 00:00:00 2001
+From: Corentin Labbe <clabbe.montjoie@gmail.com>
+Date: Fri, 1 Sep 2017 13:56:04 +0200
+Subject: net: mdio-mux: fix unbalanced put_device
+
+From: Corentin Labbe <clabbe.montjoie@gmail.com>
+
+commit 60f786525032432af1b7d9b8935cb12936244ccd upstream.
+
+mdio_mux_uninit() call put_device (unconditionally) because of
+of_mdio_find_bus() in mdio_mux_init.
+But of_mdio_find_bus is only called if mux_bus is empty.
+If mux_bus is set, mdio_mux_uninit will print a "refcount_t: underflow"
+trace.
+
+This patch add a get_device in the other branch of "if (mux_bus)".
+
+Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/phy/mdio-mux.c |    6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/phy/mdio-mux.c
++++ b/drivers/net/phy/mdio-mux.c
+@@ -117,6 +117,7 @@ int mdio_mux_init(struct device *dev,
+       } else {
+               parent_bus_node = NULL;
+               parent_bus = mux_bus;
++              get_device(&parent_bus->dev);
+       }
+       pb = devm_kzalloc(dev, sizeof(*pb), GFP_KERNEL);
+@@ -182,9 +183,7 @@ int mdio_mux_init(struct device *dev,
+       devm_kfree(dev, pb);
+ err_pb_kz:
+-      /* balance the reference of_mdio_find_bus() took */
+-      if (!mux_bus)
+-              put_device(&parent_bus->dev);
++      put_device(&parent_bus->dev);
+ err_parent_bus:
+       of_node_put(parent_bus_node);
+       return ret_val;
+@@ -202,7 +201,6 @@ void mdio_mux_uninit(void *mux_handle)
+               cb = cb->next;
+       }
+-      /* balance the reference of_mdio_find_bus() in mdio_mux_init() took */
+       put_device(&pb->mii_bus->dev);
+ }
+ EXPORT_SYMBOL_GPL(mdio_mux_uninit);
index 8f8daa283e01cc56ef79c59a83a16449bbd210e2..9f01d3d6a75407b05ffd77c65b0ac9150f794808 100644 (file)
@@ -156,3 +156,4 @@ powerpc-bpf-fix-bpf_sub-when-imm-0x80000000.patch
 mm-oom-pagefault_out_of_memory-don-t-force-global-oom-for-dying-tasks.patch
 mm-oom-do-not-trigger-out_of_memory-from-the-pf.patch
 pci-add-pci_exp_devctl_payload_-macros.patch
+net-mdio-mux-fix-unbalanced-put_device.patch