Skip to contentSkip to conversation

Patch "net: korina: Fix NAPI versus resources freeing" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jul 3, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

net: korina: Fix NAPI versus resources freeing

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
net-korina-fix-napi-versus-resources-freeing.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From e6afb1ad88feddf2347ea779cfaf4d03d3cd40b6 Mon Sep 17 00:00:00 2001

From: Florian Fainelli <[email protected]>
Date: Fri, 23 Dec 2016 19:56:56 -0800
Subject: net: korina: Fix NAPI versus resources freeing

From: Florian Fainelli <[email protected]>

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")
---
 drivers/net/ethernet/korina.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/korina.c +4 -4
@@ -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);

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/net-korina-fix-napi-versus-resources-freeing.patch queue-4.9/net-phy-use-boolean-dt-properties-for-eee-broken-modes.patch queue-4.9/dt-bindings-net-use-boolean-dt-properties-for-eee-broken-modes.patch