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, 25 Jun 2019 11:25:40 +0000
From:   Jose Abreu <Jose.Abreu@...opsys.com>
To:     Jon Hunter <jonathanh@...dia.com>,
        Jose Abreu <Jose.Abreu@...opsys.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:     Joao Pinto <Joao.Pinto@...opsys.com>,
        "David S . Miller" <davem@...emloft.net>,
        Giuseppe Cavallaro <peppe.cavallaro@...com>,
        "Alexandre Torgue" <alexandre.torgue@...com>,
        Russell King <linux@...linux.org.uk>,
        Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        "Heiner Kallweit" <hkallweit1@...il.com>,
        linux-tegra <linux-tegra@...r.kernel.org>
Subject: RE: [PATCH net-next 3/3] net: stmmac: Convert to phylink and remove
 phylib logic

From: Jon Hunter <jonathanh@...dia.com>

> I have been looking at this a bit closer and I can see the problem. What
> happens is that ...
> 
> 1. stmmac_mac_link_up() is called and priv->eee_active is set to false
> 2. stmmac_eee_init() is called but because priv->eee_active is false,
>    timer_setup() for eee_ctrl_timer is never called.
> 3. stmmac_eee_init() returns true and so then priv->eee_enabled is set 
>    to true.
> 4. When stmmac_tx_clean() is called because priv->eee_enabled is set to    
>    true, mod_timer() is called for the eee_ctrl_timer, but because 
>    timer_setup() was never called, we hit the BUG defined at
>    kernel/time/timer.c:952, because no function is defined for the 
>    timer.
> 
> The following fixes it for me ...
> 
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -399,10 +399,13 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
>         mutex_lock(&priv->lock);
>  
>         /* Check if it needs to be deactivated */
> -       if (!priv->eee_active && priv->eee_enabled) {
> -               netdev_dbg(priv->dev, "disable EEE\n");
> -               del_timer_sync(&priv->eee_ctrl_timer);
> -               stmmac_set_eee_timer(priv, priv->hw, 0, tx_lpi_timer);
> +       if (!priv->eee_active) {
> +               if (priv->eee_enabled) {
> +                       netdev_dbg(priv->dev, "disable EEE\n");
> +                       del_timer_sync(&priv->eee_ctrl_timer);
> +                       stmmac_set_eee_timer(priv, priv->hw, 0, tx_lpi_timer);
> +               }
> +               mutex_unlock(&priv->lock);
>                 return false;
>         }
> 
> It also looks like you have a potention deadlock in the current code
> because in the case of if (!priv->eee_active && priv->eee_enabled)
> you don't unlock the mutex. The above fixes this as well. I can send a
> formal patch if this looks correct. 

Thanks for looking into this! The fix looks correct so if you could 
submit a patch it would be great!

Thanks,
Jose Miguel Abreu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ