From 7b39e3e6e9fe6917a30de29a4df3e8710ee4c1db Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 3 Jul 2017 11:52:59 +0200 Subject: [PATCH] 4.9-stable patches added patches: net-korina-fix-napi-versus-resources-freeing.patch --- ...na-fix-napi-versus-resources-freeing.patch | 59 +++++++++++++++++++ queue-4.9/series | 1 + 2 files changed, 60 insertions(+) create mode 100644 queue-4.9/net-korina-fix-napi-versus-resources-freeing.patch diff --git a/queue-4.9/net-korina-fix-napi-versus-resources-freeing.patch b/queue-4.9/net-korina-fix-napi-versus-resources-freeing.patch new file mode 100644 index 00000000000..21e4d7e6df6 --- /dev/null +++ b/queue-4.9/net-korina-fix-napi-versus-resources-freeing.patch @@ -0,0 +1,59 @@ +From e6afb1ad88feddf2347ea779cfaf4d03d3cd40b6 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Fri, 23 Dec 2016 19:56:56 -0800 +Subject: net: korina: Fix NAPI versus resources freeing + +From: Florian Fainelli + +commit e6afb1ad88feddf2347ea779cfaf4d03d3cd40b6 upstream. + +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. + +Fixes: beb0babfb77e ("korina: disable napi on close and restart") +Reported-by: Alexandros C. Couloumbis +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Amit Pundir +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/korina.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/net/ethernet/korina.c ++++ b/drivers/net/ethernet/korina.c +@@ -900,10 +900,10 @@ static void korina_restart_task(struct w + DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR, + &lp->rx_dma_regs->dmasm); + +- korina_free_ring(dev); +- + napi_disable(&lp->napi); + ++ korina_free_ring(dev); ++ + if (korina_init(dev) < 0) { + printk(KERN_ERR "%s: cannot restart device\n", dev->name); + return; +@@ -1064,12 +1064,12 @@ static int korina_close(struct net_devic + tmp = tmp | DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR; + writel(tmp, &lp->rx_dma_regs->dmasm); + +- korina_free_ring(dev); +- + napi_disable(&lp->napi); + + cancel_work_sync(&lp->restart_task); + ++ korina_free_ring(dev); ++ + free_irq(lp->rx_irq, dev); + free_irq(lp->tx_irq, dev); + free_irq(lp->ovr_irq, dev); diff --git a/queue-4.9/series b/queue-4.9/series index 97d1336811d..898475daa50 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -68,3 +68,4 @@ drm-amdgpu-fix-program-vce-instance-logic-error.patch drm-amdgpu-add-support-for-new-hainan-variants.patch net-phy-dp83848-add-dp83620-phy-support.patch perf-x86-intel-handle-exclusive-threadid-correctly-on-cpu-hotplug.patch +net-korina-fix-napi-versus-resources-freeing.patch -- 2.47.3