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]
Date:   Tue, 7 Nov 2017 11:00:46 +0100
From:   Michael Grzeschik <mgr@...gutronix.de>
To:     Nicolas Ferre <nicolas.ferre@...rochip.com>
Cc:     netdev@...r.kernel.org, kernel@...gutronix.de, andrew@...n.ch
Subject: Re: [PATCH 2/2] net: macb: add of_node_put to error paths

On Tue, Nov 07, 2017 at 10:27:20AM +0100, Nicolas Ferre wrote:
> On 06/11/2017 at 12:10, Michael Grzeschik wrote:
> > We add the call of_node_put(bp->phy_node) to all associated error
> > paths for memory clean up.
> > 
> > Signed-off-by: Michael Grzeschik <m.grzeschik@...gutronix.de>
> > ---
> >  drivers/net/ethernet/cadence/macb_main.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> > index 2c2acd011329a..2698a1fde39c7 100644
> > --- a/drivers/net/ethernet/cadence/macb_main.c
> > +++ b/drivers/net/ethernet/cadence/macb_main.c
> > @@ -611,6 +611,7 @@ static int macb_mii_init(struct macb *bp)
> >  err_out_unregister_bus:
> >  	mdiobus_unregister(bp->mii_bus);
> >  err_out_free_mdiobus:
> > +	of_node_put(bp->phy_node);
> 
> okay
> 
> >  	if ((np) && (of_phy_is_fixed_link(np)))
> >  		of_phy_deregister_fixed_link(np);
> >  	mdiobus_free(bp->mii_bus);
> > @@ -3554,6 +3555,7 @@ static int macb_probe(struct platform_device *pdev)
> >  err_out_unregister_mdio:
> >  	phy_disconnect(dev->phydev);
> >  	mdiobus_unregister(bp->mii_bus);
> > +	of_node_put(bp->phy_node);
> 
> yes
> 
> >  	if ((np) && (of_phy_is_fixed_link(np)))
> >  		of_phy_deregister_fixed_link(np);
> >  	mdiobus_free(bp->mii_bus);
> > @@ -3587,6 +3589,7 @@ static int macb_remove(struct platform_device *pdev)
> >  		if (dev->phydev)
> >  			phy_disconnect(dev->phydev);
> >  		mdiobus_unregister(bp->mii_bus);
> > +		of_node_put(bp->phy_node);
> 
> Isn't this call already done some lines below, just before
> "free_netdev(dev);"?

You are absolutely right. Will send v2.

> >  		if ((np) && (of_phy_is_fixed_link(np)))
> >  			of_phy_deregister_fixed_link(np);
> >  		dev->phydev = NULL;
> > 
> 
> Thanks for your patch.
Thanks,
Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ