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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201114124506.13847db4@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Sat, 14 Nov 2020 12:45:06 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Wong Vee Khee <vee.khee.wong@...el.com>
Cc:     Giuseppe Cavallaro <peppe.cavallaro@...com>,
        Alexandre Torgue <alexandre.torgue@...com>,
        Jose Abreu <joabreu@...opsys.com>,
        "David S . Miller" <davem@...emloft.net>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        netdev@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Ong Boon Leong <boon.leong.ong@...el.com>,
        Voon Wei Feng <weifeng.voon@...el.com>,
        Christophe ROULLIER <christophe.roullier@...com>
Subject: Re: [PATCH net 1/1] net: stmmac: Use rtnl_lock/unlock on
 netif_set_real_num_rx_queues() call

On Thu, 12 Nov 2020 22:49:48 +0800 Wong Vee Khee wrote:
> Fix an issue where dump stack is printed on suspend resume flow due to
> netif_set_real_num_rx_queues() is not called with rtnl_lock held().
> 
> Fixes: 686cff3d7022 ("net: stmmac: Fix incorrect location to set real_num_rx|tx_queues")
> Reported-by: Christophe ROULLIER <christophe.roullier@...com>
> Tested-by: Christophe ROULLIER <christophe.roullier@...com>
> Cc: Alexandre TORGUE <alexandre.torgue@...com>
> Reviewed-by: Ong Boon Leong <boon.leong.ong@...el.com>
> Signed-off-by: Wong Vee Khee <vee.khee.wong@...el.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index ba855465a2db..33e280040000 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -5278,7 +5278,10 @@ int stmmac_resume(struct device *dev)
>  
>  	stmmac_clear_descriptors(priv);
>  
> +	rtnl_lock();
>  	stmmac_hw_setup(ndev, false);
> +	rtnl_unlock();
> +
>  	stmmac_init_coalesce(priv);
>  	stmmac_set_rx_mode(ndev);
>  

Doesn't look quite right. This is under the priv->lock which is
sometimes taken under rtnl_lock. So theoretically there could be
a deadlock.

You should probably take rtnl_lock() before priv->lock and release 
it after. It's pretty common for drivers to hold rtnl_lock around 
most of the resume method.

With larger context:
 

        mutex_lock(&priv->lock);
 
        stmmac_reset_queues_param(priv);
 
        stmmac_clear_descriptors(priv);
 
+       rtnl_lock();
        stmmac_hw_setup(ndev, false);
+       rtnl_unlock();
+
        stmmac_init_coalesce(priv);
        stmmac_set_rx_mode(ndev);
 
        stmmac_restore_hw_vlan_rx_fltr(priv, ndev, priv->hw);
 
        stmmac_enable_all_queues(priv);
 
        mutex_unlock(&priv->lock);
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ