Skip to contentSkip to conversation

net: macb: add missed tasklet_kill

PATCH Superseded Chuhong Yuan 2 participants 2 messages Nov 23, 2019 – Nov 25, 2019

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 net: macb: add missed tasklet_kill

This driver forgets to kill tasklet in remove.
Add the call to fix it.

Fixes 032dc41ba6e2 ("net: macb: Handle HRESP error")

---
Changes in v3:
- Add fixes tag and target 'net'.

 drivers/net/ethernet/cadence/macb_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/cadence/macb_main.c +1 -0
index 1e1b774e1953..2ec416098fa3 100644
@@ -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);
Signature · 1 line
2.24.0
#1 lore raw
Quoted 5 lines · Chuhong Yuan

This driver forgets to kill tasklet in remove.
Add the call to fix it.

Fixes 032dc41ba6e2 ("net: macb: Handle HRESP error")

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.

Quoted 12 lines
drivers/net/ethernet/cadence/macb_main.c +1 -0
index 1e1b774e1953..2ec416098fa3 100644
@@ -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);