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, 20 Dec 2022 13:41:08 +0100
From:   Paolo Abeni <pabeni@...hat.com>
To:     Enguerrand de Ribaucourt 
        <enguerrand.de-ribaucourt@...oirfairelinux.com>,
        netdev@...r.kernel.org
Cc:     woojung.huh@...rochip.com, davem@...emloft.net,
        UNGLinuxDriver@...rochip.com
Subject: Re: [PATCH v2] net: lan78xx: prevent LAN88XX specific operations

On Tue, 2022-12-20 at 12:37 +0100, Enguerrand de Ribaucourt wrote:
> Some operations during the cable switch workaround modify the register
> LAN88XX_INT_MASK of the PHY. However, this register is specific to the
> LAN8835 PHY. For instance, if a DP8322I PHY is connected to the LAN7801,
> that register (0x19), corresponds to the LED and MAC address
> configuration, resulting in unapropriate behavior.
> 
> Use the generic phy interrupt functions instead.
> 
> Fixes: 89b36fb5e532 ("lan78xx: Lan7801 Support for Fixed PHY")
> Reviewed-by: Paolo Abeni <pabeni@...hat.com>;

You should not attach this tag (or acked-by) on your own. 

The following is not even the code I was _asking_ about...

> Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@...oirfairelinux.com>
> ---
>  drivers/net/usb/lan78xx.c | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> index f18ab8e220db..65d5d54994ff 100644
> --- a/drivers/net/usb/lan78xx.c
> +++ b/drivers/net/usb/lan78xx.c
> @@ -28,6 +28,7 @@
>  #include <linux/phy_fixed.h>
>  #include <linux/of_mdio.h>
>  #include <linux/of_net.h>
> +#include <linux/phy.h>
>  #include "lan78xx.h"
>  
>  #define DRIVER_AUTHOR	"WOOJUNG HUH <woojung.huh@...rochip.com>"
> @@ -2123,10 +2124,7 @@ static void lan78xx_link_status_change(struct net_device *net)
>  	 * at forced 100 F/H mode.
>  	 */
>  	if (!phydev->autoneg && (phydev->speed == 100)) {
> -		/* disable phy interrupt */
> -		temp = phy_read(phydev, LAN88XX_INT_MASK);
> -		temp &= ~LAN88XX_INT_MASK_MDINTPIN_EN_;
> -		phy_write(phydev, LAN88XX_INT_MASK, temp);
> +		phy_disable_interrupts(phydev);
>  
>  		temp = phy_read(phydev, MII_BMCR);
>  		temp &= ~(BMCR_SPEED100 | BMCR_SPEED1000);
> @@ -2134,13 +2132,7 @@ static void lan78xx_link_status_change(struct net_device *net)
>  		temp |= BMCR_SPEED100;
>  		phy_write(phydev, MII_BMCR, temp); /* set to 100 later */
>  
> -		/* clear pending interrupt generated while workaround */
> -		temp = phy_read(phydev, LAN88XX_INT_STS);
> -
> -		/* enable phy interrupt back */
> -		temp = phy_read(phydev, LAN88XX_INT_MASK);
> -		temp |= LAN88XX_INT_MASK_MDINTPIN_EN_;
> -		phy_write(phydev, LAN88XX_INT_MASK, temp);
> +		phy_request_interrupt(phydev);

This looks wrong. Should probably be:

	phy_enable_interrupts(phydev);


Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ