lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1480357509-28074-5-git-send-email-johan@kernel.org>
Date:   Mon, 28 Nov 2016 19:24:57 +0100
From:   Johan Hovold <johan@...nel.org>
To:     "David S. Miller" <davem@...emloft.net>
Cc:     Vince Bridgers <vbridger@...nsource.altera.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Fugang Duan <fugang.duan@....com>,
        Pantelis Antoniou <pantelis.antoniou@...il.com>,
        Vitaly Bordug <vbordug@...mvista.com>,
        Claudiu Manoil <claudiu.manoil@...escale.com>,
        Li Yang <leoli@...escale.com>,
        Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
        Felix Fietkau <nbd@...nwrt.org>,
        John Crispin <blogic@...nwrt.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
        Lars Persson <lars.persson@...s.com>,
        Mugunthan V N <mugunthanvnm@...com>,
        Grygorii Strashko <grygorii.strashko@...com>,
        Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
        netdev@...r.kernel.org, nios2-dev@...ts.rocketboards.org,
        linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
        linux-mediatek@...ts.infradead.org,
        linux-renesas-soc@...r.kernel.org, linux-omap@...r.kernel.org,
        devicetree@...r.kernel.org, Johan Hovold <johan@...nel.org>
Subject: [PATCH net 04/16] net: ethernet: aurora: nb8800: fix fixed-link phydev leaks

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: c7dfe3abf40e ("net: ethernet: nb8800: support fixed-link DT
node")
Signed-off-by: Johan Hovold <johan@...nel.org>
---
 drivers/net/ethernet/aurora/nb8800.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c
index 00c38bf151e6..e078d8da978c 100644
--- a/drivers/net/ethernet/aurora/nb8800.c
+++ b/drivers/net/ethernet/aurora/nb8800.c
@@ -1466,12 +1466,12 @@ static int nb8800_probe(struct platform_device *pdev)
 
 	ret = nb8800_hw_init(dev);
 	if (ret)
-		goto err_free_bus;
+		goto err_deregister_fixed_link;
 
 	if (ops && ops->init) {
 		ret = ops->init(dev);
 		if (ret)
-			goto err_free_bus;
+			goto err_deregister_fixed_link;
 	}
 
 	dev->netdev_ops = &nb8800_netdev_ops;
@@ -1504,6 +1504,9 @@ static int nb8800_probe(struct platform_device *pdev)
 
 err_free_dma:
 	nb8800_dma_free(dev);
+err_deregister_fixed_link:
+	if (of_phy_is_fixed_link(pdev->dev.of_node))
+		of_phy_deregister_fixed_link(pdev->dev.of_node);
 err_free_bus:
 	of_node_put(priv->phy_node);
 	mdiobus_unregister(bus);
@@ -1521,6 +1524,8 @@ static int nb8800_remove(struct platform_device *pdev)
 	struct nb8800_priv *priv = netdev_priv(ndev);
 
 	unregister_netdev(ndev);
+	if (of_phy_is_fixed_link(pdev->dev.of_node))
+		of_phy_deregister_fixed_link(pdev->dev.of_node);
 	of_node_put(priv->phy_node);
 
 	mdiobus_unregister(priv->mii_bus);
-- 
2.7.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ