linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Chuhong Yuan <hslester96@gmail.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>,
	"David S . Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3] net: macb: add missed tasklet_kill
Date: Sun, 24 Nov 2019 18:21:28 -0800	[thread overview]
Message-ID: <20191124182113.481f984b@cakuba.netronome.com> (raw)
In-Reply-To: <20191123141918.16239-1-hslester96@gmail.com>

On Sat, 23 Nov 2019 22:19:18 +0800, Chuhong Yuan wrote:
> This driver forgets to kill tasklet in remove.
> Add the call to fix it.
> 
> Fixes: 032dc41ba6e2 ("net: macb: Handle HRESP error")
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>

I think this leaves a race condition, as far as I can tell
tasklet_kill() just kills the currently scheduled tasklet,
but doesn't prevent it from being scheduled again. If the 
interrupt fires just after the tasklet_kill() call the tasklet
will be scheduled back in. I think you'd need to mask the interrupt 
(through the IDR register?) or just put the tasklet_kill() call after
unregister_netdev(), because AFAICT closing the netdev disables all
irqs.

> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 1e1b774e1953..2ec416098fa3 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -4383,6 +4383,7 @@ static int macb_remove(struct platform_device *pdev)
>  
>  	if (dev) {
>  		bp = netdev_priv(dev);
> +		tasklet_kill(&bp->hresp_err_tasklet);
>  		if (dev->phydev)
>  			phy_disconnect(dev->phydev);
>  		mdiobus_unregister(bp->mii_bus);


      reply	other threads:[~2019-11-25  2:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-23 14:19 [PATCH net v3] net: macb: add missed tasklet_kill Chuhong Yuan
2019-11-25  2:21 ` Jakub Kicinski [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=20191124182113.481f984b@cakuba.netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=davem@davemloft.net \
    --cc=hslester96@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.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;
as well as URLs for NNTP newsgroup(s).