[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YtUloYvDtTxX1MQA@shell.armlinux.org.uk>
Date: Mon, 18 Jul 2022 10:19:29 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
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
Subject: Re: [net-next PATCH v3 2/5] net: ethernet: stmicro: stmmac: first
disable all queues in release
On Sun, Jul 17, 2022 at 01:07:59AM +0200, Christian Marangi wrote:
> Disable all queues before tx_disable in stmmac_release to prevent a
> corner case where packet may be still queued at the same time tx_disable
> is called resulting in kernel panic if some packet still has to be
> processed.
>
> Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 5578abb14949..1854dcdd6095 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -3758,6 +3758,11 @@ static int stmmac_release(struct net_device *dev)
> struct stmmac_priv *priv = netdev_priv(dev);
> u32 chan;
>
> + stmmac_disable_all_queues(priv);
> +
> + for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
> + hrtimer_cancel(&priv->tx_queue[chan].txtimer);
> +
> netif_tx_disable(dev);
Is there a reason not to call phylink_stop() as the very first thing in
this function? That will bring the link (and therefore carrier) down
before phylink_stop() returns which should also prevent packets being
queued into the driver for transmission.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists