Revert "[NDISC]: Fix race in generic address resolution"
authorDavid S. Miller <davem@davemloft.net>
Mon, 18 Feb 2008 02:39:54 +0000 (18:39 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 18 Feb 2008 02:39:54 +0000 (18:39 -0800)
This reverts commit 69cc64d8d92bf852f933e90c888dfff083bd4fc9.

It causes recursive locking in IPV6 because unlike other
neighbour layer clients, it even needs neighbour cache
entries to send neighbour soliciation messages :-(

We'll have to find another way to fix this race.

Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/neighbour.c
net/ipv4/arp.c

index 7bb6a9a1256df6a082d0792feca42db7d18ec0f5..a16cf1ec5e5ebe9fc100cb027c740c9387184472 100644 (file)
@@ -834,12 +834,18 @@ static void neigh_timer_handler(unsigned long arg)
        }
        if (neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) {
                struct sk_buff *skb = skb_peek(&neigh->arp_queue);
-
+               /* keep skb alive even if arp_queue overflows */
+               if (skb)
+                       skb_get(skb);
+               write_unlock(&neigh->lock);
                neigh->ops->solicit(neigh, skb);
                atomic_inc(&neigh->probes);
-       }
+               if (skb)
+                       kfree_skb(skb);
+       } else {
 out:
-       write_unlock(&neigh->lock);
+               write_unlock(&neigh->lock);
+       }
 
        if (notify)
                neigh_update_notify(neigh);
index c663fa5339ee9cbadef76d947455806ba2db8425..8e17f65f400215a72c3ac3effb908071255d2747 100644 (file)
@@ -368,6 +368,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
                if (!(neigh->nud_state&NUD_VALID))
                        printk(KERN_DEBUG "trying to ucast probe in NUD_INVALID\n");
                dst_ha = neigh->ha;
+               read_lock_bh(&neigh->lock);
        } else if ((probes -= neigh->parms->app_probes) < 0) {
 #ifdef CONFIG_ARPD
                neigh_app_ns(neigh);
@@ -377,6 +378,8 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
 
        arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
                 dst_ha, dev->dev_addr, NULL);
+       if (dst_ha)
+               read_unlock_bh(&neigh->lock);
 }
 
 static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)