[NET]: Fix neighbour destructor handling.
->neigh_destructor() is killed (not used), replaced with ->neigh_cleanup(), which is called when neighbor entry goes to dead state. At this point everything is still valid: neigh->dev, neigh->parms etc. The device should guarantee that dead neighbor entries (neigh->dead != 0) do not get private part initialized, otherwise nobody will cleanup it. I think this is enough for ipoib which is the only user of this thing. Initialization private part of neighbor entries happens in ipib start_xmit routine, which is not reached when device is down. But it would be better to add explicit test for neigh->dead in any case. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
e1701c68c1
commit
ecbb416939
@ -140,6 +140,8 @@ static int neigh_forced_gc(struct neigh_table *tbl)
|
||||
n->dead = 1;
|
||||
shrunk = 1;
|
||||
write_unlock(&n->lock);
|
||||
if (n->parms->neigh_cleanup)
|
||||
n->parms->neigh_cleanup(n);
|
||||
neigh_release(n);
|
||||
continue;
|
||||
}
|
||||
@ -211,6 +213,8 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev)
|
||||
NEIGH_PRINTK2("neigh %p is stray.\n", n);
|
||||
}
|
||||
write_unlock(&n->lock);
|
||||
if (n->parms->neigh_cleanup)
|
||||
n->parms->neigh_cleanup(n);
|
||||
neigh_release(n);
|
||||
}
|
||||
}
|
||||
@ -582,9 +586,6 @@ void neigh_destroy(struct neighbour *neigh)
|
||||
kfree(hh);
|
||||
}
|
||||
|
||||
if (neigh->parms->neigh_destructor)
|
||||
(neigh->parms->neigh_destructor)(neigh);
|
||||
|
||||
skb_queue_purge(&neigh->arp_queue);
|
||||
|
||||
dev_put(neigh->dev);
|
||||
@ -675,6 +676,8 @@ static void neigh_periodic_timer(unsigned long arg)
|
||||
*np = n->next;
|
||||
n->dead = 1;
|
||||
write_unlock(&n->lock);
|
||||
if (n->parms->neigh_cleanup)
|
||||
n->parms->neigh_cleanup(n);
|
||||
neigh_release(n);
|
||||
continue;
|
||||
}
|
||||
@ -2088,8 +2091,11 @@ void __neigh_for_each_release(struct neigh_table *tbl,
|
||||
} else
|
||||
np = &n->next;
|
||||
write_unlock(&n->lock);
|
||||
if (release)
|
||||
if (release) {
|
||||
if (n->parms->neigh_cleanup)
|
||||
n->parms->neigh_cleanup(n);
|
||||
neigh_release(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user