Message ID | 1287029519.2649.108.camel@edumazet-laptop |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Thu, 14 Oct 2010 06:11:59 +0200 > net-next-2.6 contains a fix for this, adding the perc_cpu > xmit_recursion limit. We might push it to net-2.6 We need to think a bit more about this. We are essentially now saying that one can only configure tunnels 3 levels deep, and no more. I can guarentee you someone out there uses at least 4, perhaps more. And those people will be broken by the new limit. So putting this into net-2.6 with such a low limit will be quite dangerous. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Le mardi 19 octobre 2010 à 01:53 -0700, David Miller a écrit : > From: Eric Dumazet <eric.dumazet@gmail.com> > Date: Thu, 14 Oct 2010 06:11:59 +0200 > > > net-next-2.6 contains a fix for this, adding the perc_cpu > > xmit_recursion limit. We might push it to net-2.6 > > We need to think a bit more about this. > > We are essentially now saying that one can only configure > tunnels 3 levels deep, and no more. > > I can guarentee you someone out there uses at least 4, > perhaps more. > > And those people will be broken by the new limit. > > So putting this into net-2.6 with such a low limit will > be quite dangerous. Well limit is actually 4, but I get your point ;) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/core/dev.c b/net/core/dev.c index 48ad47f..50dacca 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, return rc; } +static DEFINE_PER_CPU(int, xmit_recursion); +#define RECURSION_LIMIT 3 + /** * dev_queue_xmit - transmit a buffer * @skb: buffer to transmit @@ -2242,10 +2245,15 @@ int dev_queue_xmit(struct sk_buff *skb) if (txq->xmit_lock_owner != cpu) { + if (__this_cpu_read(xmit_recursion) > RECURSION_LIMIT) + goto recursion_alert; + HARD_TX_LOCK(dev, txq, cpu); if (!netif_tx_queue_stopped(txq)) { + __this_cpu_inc(xmit_recursion); rc = dev_hard_start_xmit(skb, dev, txq); + __this_cpu_dec(xmit_recursion); if (dev_xmit_complete(rc)) { HARD_TX_UNLOCK(dev, txq); goto out; @@ -2257,7 +2265,9 @@ int dev_queue_xmit(struct sk_buff *skb) "queue packet!\n", dev->name); } else { /* Recursion is detected! It is possible, - * unfortunately */ + * unfortunately + */ +recursion_alert: if (net_ratelimit()) printk(KERN_CRIT "Dead loop on virtual device " "%s, fix it urgently!\n", dev->name);