login
Header Space

 
 

[PATCH] net: fix race in process_backlog

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: linux-kernel <linux-kernel@...>, netdev <netdev@...>
Cc: Stephen Hemminger <shemminger@...>, Jeff Dike <jdike@...>, David Miller <davem@...>
Date: Wednesday, October 3, 2007 - 11:44 am

Subject: net: fix race in process_backlog

The recent NAPI rework (4fa57c9ea9f36f9ca852f3a88ca5d2f1aebbc960)
introduced a race between netif_rx() and process_backlog() which
resulted in softirq processing to drop dead.

netif_rx()		process_backlog()

			irq_disable();
			skb = __skb_dequeue();
			irq_enable();

irq_disable();
__skb_queue_tail();
napi_schedule();
irq_enable();

			if (!skb)
			  napi_complete();  <-- oops!

we cleared the napi bit, even though there is data to process.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 net/core/dev.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/net/core/dev.c
===================================================================
--- linux-2.6.orig/net/core/dev.c
+++ linux-2.6/net/core/dev.c
@@ -2095,11 +2095,11 @@ static int process_backlog(struct napi_s
 
 		local_irq_disable();
 		skb = __skb_dequeue(&queue->input_pkt_queue);
-		local_irq_enable();
 		if (!skb) {
-			napi_complete(napi);
+			__napi_complete(napi);
 			break;
 		}
+		local_irq_enable();
 
 		dev = skb->dev;
 


-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] net: fix race in process_backlog, Peter Zijlstra, (Wed Oct 3, 11:44 am)
Re: [PATCH] net: fix race in process_backlog, David Miller, (Wed Oct 3, 5:58 pm)
Re: [PATCH] net: fix race in process_backlog, Stephen Hemminger, (Wed Oct 3, 6:05 pm)
Re: [PATCH] net: fix race in process_backlog, David Miller, (Wed Oct 3, 7:39 pm)
Re: [PATCH] net: fix race in process_backlog, Stephen Hemminger, (Wed Oct 3, 12:15 pm)
speck-geostationary