Skip to contentSkip to conversation

net: emac: Fix napi poll list corruption

PATCH In review Christian Lamparter 2 participants 2 messages Sep 19, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: emac: Fix napi poll list corruption

This patch is pretty much a carbon copy of
commit 3079c652141f ("caif: Fix napi poll list corruption") with "caif" replaced by "emac".

The commit d75b1ade567f ("net: less interrupt masking in NAPI") breaks emac.

It is now required that if the entire budget is consumed when poll returns, the napi poll_list must remain empty. However, like some other drivers emac tries to do a last-ditch check and if there is more work it will call napi_reschedule and then immediately process some of this new work. Should the entire budget be consumed while processing such new work then we will violate the new caller contract.

This patch fixes this by not touching any work when we reschedule in emac.

---
 drivers/net/ethernet/ibm/emac/mal.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/ibm/emac/mal.c +1 -2
index 2c74baa2398a..fff09dcf9e34 100644
@@ -402,7 +402,7 @@ static int mal_poll(struct napi_struct *napi, int budget)
 	unsigned long flags;
 
 	MAL_DBG2(mal, "poll(%d)" NL, budget);
- again:
+
 	/* Process TX skbs */
 	list_for_each(l, &mal->poll_list) {
 		struct mal_commac *mc =
@@ -451,7 +451,6 @@ static int mal_poll(struct napi_struct *napi, int budget)
 			spin_lock_irqsave(&mal->lock, flags);
 			mal_disable_eob_irq(mal);
 			spin_unlock_irqrestore(&mal->lock, flags);
-			goto again;
 		}
 		mc->ops->poll_tx(mc->dev);
 	}
Signature · 1 line
2.14.1
maintainer
#1 lore raw

From: Christian Lamparter <[email protected]>
Date: Tue, 19 Sep 2017 19:35:18 +0200

Quoted 15 lines

This patch is pretty much a carbon copy of
commit 3079c652141f ("caif: Fix napi poll list corruption") with "caif" replaced by "emac".

The commit d75b1ade567f ("net: less interrupt masking in NAPI") breaks emac.

It is now required that if the entire budget is consumed when poll returns, the napi poll_list must remain empty. However, like some other drivers emac tries to do a last-ditch check and if there is more work it will call napi_reschedule and then immediately process some of this new work. Should the entire budget be consumed while processing such new work then we will violate the new caller contract.

Quoted 4 lines

This patch fixes this by not touching any work when we reschedule in emac.

Applied and queued up for -stable, thanks.