aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 48ad47f402ad..50daccad6a53 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2177,6 +2177,9 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
2177 return rc; 2177 return rc;
2178} 2178}
2179 2179
2180static DEFINE_PER_CPU(int, xmit_recursion);
2181#define RECURSION_LIMIT 3
2182
2180/** 2183/**
2181 * dev_queue_xmit - transmit a buffer 2184 * dev_queue_xmit - transmit a buffer
2182 * @skb: buffer to transmit 2185 * @skb: buffer to transmit
@@ -2242,10 +2245,15 @@ int dev_queue_xmit(struct sk_buff *skb)
2242 2245
2243 if (txq->xmit_lock_owner != cpu) { 2246 if (txq->xmit_lock_owner != cpu) {
2244 2247
2248 if (__this_cpu_read(xmit_recursion) > RECURSION_LIMIT)
2249 goto recursion_alert;
2250
2245 HARD_TX_LOCK(dev, txq, cpu); 2251 HARD_TX_LOCK(dev, txq, cpu);
2246 2252
2247 if (!netif_tx_queue_stopped(txq)) { 2253 if (!netif_tx_queue_stopped(txq)) {
2254 __this_cpu_inc(xmit_recursion);
2248 rc = dev_hard_start_xmit(skb, dev, txq); 2255 rc = dev_hard_start_xmit(skb, dev, txq);
2256 __this_cpu_dec(xmit_recursion);
2249 if (dev_xmit_complete(rc)) { 2257 if (dev_xmit_complete(rc)) {
2250 HARD_TX_UNLOCK(dev, txq); 2258 HARD_TX_UNLOCK(dev, txq);
2251 goto out; 2259 goto out;
@@ -2257,7 +2265,9 @@ int dev_queue_xmit(struct sk_buff *skb)
2257 "queue packet!\n", dev->name); 2265 "queue packet!\n", dev->name);
2258 } else { 2266 } else {
2259 /* Recursion is detected! It is possible, 2267 /* Recursion is detected! It is possible,
2260 * unfortunately */ 2268 * unfortunately
2269 */
2270recursion_alert:
2261 if (net_ratelimit()) 2271 if (net_ratelimit())
2262 printk(KERN_CRIT "Dead loop on virtual device " 2272 printk(KERN_CRIT "Dead loop on virtual device "
2263 "%s, fix it urgently!\n", dev->name); 2273 "%s, fix it urgently!\n", dev->name);