linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3] net: macb: add missed tasklet_kill
@ 2019-11-23 14:19 Chuhong Yuan
  2019-11-25  2:21 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Chuhong Yuan @ 2019-11-23 14:19 UTC (permalink / raw)
  Cc: Nicolas Ferre, David S . Miller, netdev, linux-kernel, Chuhong Yuan

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>
---
Changes in v3:
  - Add fixes tag and target 'net'.

 drivers/net/ethernet/cadence/macb_main.c | 1 +
 1 file changed, 1 insertion(+)

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);
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net v3] net: macb: add missed tasklet_kill
  2019-11-23 14:19 [PATCH net v3] net: macb: add missed tasklet_kill Chuhong Yuan
@ 2019-11-25  2:21 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2019-11-25  2:21 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: Nicolas Ferre, David S . Miller, netdev, linux-kernel

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);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-25  2:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-23 14:19 [PATCH net v3] net: macb: add missed tasklet_kill Chuhong Yuan
2019-11-25  2:21 ` Jakub Kicinski

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).