mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yunsheng Lin <linyunsheng@huawei.com>
To: Zheng Wang <zyytlz.wz@163.com>, <davem@davemloft.net>
Cc: <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<mkl@pengutronix.de>, <j.neuschaefer@gmx.net>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<hackerzheng666@gmail.com>, <1395428693sheep@gmail.com>,
	<alex000young@gmail.com>
Subject: Re: [PATCH net v2] net: calxedaxgmac: fix race condition in xgmac_remove due to unfinished work
Date: Mon, 13 Mar 2023 09:22:07 +0800	[thread overview]
Message-ID: <6f0dc4f0-8a1a-9512-01f8-71b0ce6024ea@huawei.com> (raw)
In-Reply-To: <20230311180404.4007176-1-zyytlz.wz@163.com>

On 2023/3/12 2:04, Zheng Wang wrote:
> In xgmac_probe, the priv->tx_timeout_work is bound with
> xgmac_tx_timeout_work. In xgmac_remove, if there is an
> unfinished work, there might be a race condition that
> priv->base was written byte after iounmap it.
> 
> Fix it by finishing the work before cleanup.
> 
> Fixes: 8746f671ef04 ("net: calxedaxgmac: fix race between xgmac_tx_complete and xgmac_tx_err")
> Signed-off-by: Zheng Wang <zyytlz.wz@163.com>


LGTM.
Reviewed-by: Yunsheng Lin <linyunsheng@huawei.com>

> ---
> v2:
> - fix typo,add Fixes label and stop dev_watchdog so that it will handle no more timeout work suggested by Yunsheng Lin
> ---
>  drivers/net/ethernet/calxeda/xgmac.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
> index f4f87dfa9687..f0880538f6f3 100644
> --- a/drivers/net/ethernet/calxeda/xgmac.c
> +++ b/drivers/net/ethernet/calxeda/xgmac.c
> @@ -1832,6 +1832,10 @@ static int xgmac_remove(struct platform_device *pdev)
>  	free_irq(ndev->irq, ndev);
>  	free_irq(priv->pmt_irq, ndev);
>  
> +	netif_carrier_off(ndev);
> +	netif_tx_disable(ndev);
> +	cancel_work_sync(&priv->tx_timeout_work);
> +
>  	unregister_netdev(ndev);
>  	netif_napi_del(&priv->napi);
>  
> 

      reply	other threads:[~2023-03-13  1:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-11 18:04 Zheng Wang
2023-03-13  1:22 ` Yunsheng Lin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6f0dc4f0-8a1a-9512-01f8-71b0ce6024ea@huawei.com \
    --to=linyunsheng@huawei.com \
    --cc=1395428693sheep@gmail.com \
    --cc=alex000young@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hackerzheng666@gmail.com \
    --cc=j.neuschaefer@gmx.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=zyytlz.wz@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®