From: Hiroshi Shimamoto
Calling netif_receive_skb() from memnic thread may cause deadlock, if
softirq is not disabled.
The netif_receive_skb() should be called in softirq context, but memnic
thread is not softirq context. That may conflict softirq work like a
timer handler in kernel network stack.
Signed-off-by: Hiroshi Shimamoto
Reviewed-by: Hayato Momma
---
linux/memnic_net.c | 6 ++
1 file changed, 6 insertions(+)
diff --git a/linux/memnic_net.c b/linux/memnic_net.c
index fadece6..a1b433a 100644
--- a/linux/memnic_net.c
+++ b/linux/memnic_net.c
@@ -133,8 +133,14 @@ static int memnic_thread(void *param)
continue;
}
+ local_bh_disable();
+ /*
+* Disable softirq here to avoid race between timers and
+* netif_receive_skb
+*/
for (i = 0; i < n; i++)
netif_receive_skb(skbs[i]);
+ local_bh_enable();
cnt = 0;
}
--
1.8.4