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] [day] [month] [year] [list]
Message-ID: <YR15ku/FsZN55/Pi@lunn.ch>
Date:   Wed, 18 Aug 2021 23:20:18 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Gerhard Engleder <gerhard@...leder-embedded.com>
Cc:     netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 1/2] net: phy: Support set_loopback override

> I saw only 4 references for to_phy_driver():
> - phy_loopback() of course
> - phy_probe() which uses it to initialize phydev->drv 3 lines later

This is correct. The driver core will set dev.driver to what it thinks
is the correct driver to use, before calling probe.

> - mdio_bus_phy_may_suspend() which checks only for valid suspend function
>   pointer, but later phy_suspend() uses phydev->drv, so this is at
>   least inconsistent

I guess the real question here is, can a device be suspended before it
is probed? It would seem rather odd. So i expect phydev->drv is safe
to use.

> - phy_bus_match() which casts from struct device_driver to struct phy_driver

This is used by the driver core when trying to find a matching
driver. So it is used before phy_probe(). So this is correct.

> 
> phydev->drv is used much more often and seems to be the right way. I suggest to
> also fix mdio_bus_phy_may_suspend(). phy_probe() and phy_bus_match() are
> valid uses, because phydev->drv is not available for them.
> 
> Do you agree?

Agreed. Thanks for spending the time to look at this. I was expecting
there to be more problems than just loopback.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ