This is a note to let you know that I've just added the patch titled net: ethernet: gianfar: fix fixed-link phydev leaks to the 4.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-ethernet-gianfar-fix-fixed-link-phydev-leaks.patch and it can be found in the queue-4.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 42c70042458d74ce049ce4a2ea7702f344a0dc0b Mon Sep 17 00:00:00 2001 From: Johan Hovold <johan@xxxxxxxxxx> Date: Mon, 28 Nov 2016 19:25:02 +0100 Subject: net: ethernet: gianfar: fix fixed-link phydev leaks From: Johan Hovold <johan@xxxxxxxxxx> commit 42c70042458d74ce049ce4a2ea7702f344a0dc0b upstream. Make sure to deregister and free any fixed-link PHY registered using of_phy_register_fixed_link() on probe errors and on driver unbind. Fixes: be40364544bd ("gianfar: use the new fixed PHY helpers") Signed-off-by: Johan Hovold <johan@xxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/ethernet/freescale/gianfar.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -1313,6 +1313,7 @@ static void gfar_init_addr_hash_table(st */ static int gfar_probe(struct platform_device *ofdev) { + struct device_node *np = ofdev->dev.of_node; struct net_device *dev = NULL; struct gfar_private *priv = NULL; int err = 0, i; @@ -1465,6 +1466,8 @@ static int gfar_probe(struct platform_de return 0; register_fail: + if (of_phy_is_fixed_link(np)) + of_phy_deregister_fixed_link(np); unmap_group_regs(priv); gfar_free_rx_queues(priv); gfar_free_tx_queues(priv); @@ -1477,11 +1480,16 @@ register_fail: static int gfar_remove(struct platform_device *ofdev) { struct gfar_private *priv = platform_get_drvdata(ofdev); + struct device_node *np = ofdev->dev.of_node; of_node_put(priv->phy_node); of_node_put(priv->tbi_node); unregister_netdev(priv->ndev); + + if (of_phy_is_fixed_link(np)) + of_phy_deregister_fixed_link(np); + unmap_group_regs(priv); gfar_free_rx_queues(priv); gfar_free_tx_queues(priv); Patches currently in stable-queue which might be from johan@xxxxxxxxxx are queue-4.4/of_mdio-fix-node-leak-in-of_phy_register_fixed_link-error-path.patch queue-4.4/net-ethernet-gianfar-fix-fixed-link-phydev-leaks.patch queue-4.4/net-ethernet-ucc_geth-fix-fixed-link-phydev-leaks.patch queue-4.4/phy-fix-device-reference-leaks.patch queue-4.4/net-dsa-slave-fix-of-node-leak-and-phy-priority.patch queue-4.4/net-ethernet-marvell-mvneta-fix-fixed-link-phydev-leaks.patch queue-4.4/net-ethernet-fs_enet-fix-fixed-link-phydev-leaks.patch