Commit beb0babfb77e ("korina: disable napi on close and restart") introduced calls to napi_disable() that were missing before, unfortunately this leaves a small window during which NAPI has a chance to run, yet we just freed resources since korina_free_ring() has been called: Fix this by disabling NAPI first then freeing resource, and make sure that we also cancel the restart task before doing the resource freeing.
Unified · Split
| @@ -900,10 +900,10 @@ static void korina_restart_task(struct work_struct *work) · 899 unmodified lines | ||
| 900 | 900 | DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR, |
| 901 | 901 | &lp->rx_dma_regs->dmasm); |
| 902 | 902 | |
| 903 | − korina_free_ring(dev); | |
| 904 | − | |
| 905 | 903 | napi_disable(&lp->napi); |
| 906 | 904 | |
| 905 | + korina_free_ring(dev); | |
| 906 | + | |
| 907 | 907 | if (korina_init(dev) < 0) { |
| 908 | 908 | printk(KERN_ERR "%s: cannot restart device\n", dev->name); |
| 909 | 909 | return; |
| @@ -1064,12 +1064,12 @@ static int korina_close(struct net_device *dev) · 154 unmodified lines | ||
| 1064 | 1064 | tmp = tmp | DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR; |
| 1065 | 1065 | writel(tmp, &lp->rx_dma_regs->dmasm); |
| 1066 | 1066 | |
| 1067 | − korina_free_ring(dev); | |
| 1068 | − | |
| 1069 | 1067 | napi_disable(&lp->napi); |
| 1070 | 1068 | |
| 1071 | 1069 | cancel_work_sync(&lp->restart_task); |
| 1072 | 1070 | |
| 1071 | + korina_free_ring(dev); | |
| 1072 | + | |
| 1073 | 1073 | free_irq(lp->rx_irq, dev); |
| 1074 | 1074 | free_irq(lp->tx_irq, dev); |
| 1075 | 1075 | free_irq(lp->ovr_irq, dev); |