diff options
author | Veaceslav Falico <vfalico@redhat.com> | 2013-08-02 13:07:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-02 18:44:23 -0400 |
commit | 63134803a6369dcf7dddf7f0d5e37b9566b308d2 (patch) | |
tree | 91989560d7550d8664835abbe977beabe01e137e /net/core | |
parent | 8a849bb7f0ac513c2b7202620f611d94301c4a93 (diff) |
neighbour: populate neigh_parms on alloc before calling ndo_neigh_setup
dev->ndo_neigh_setup() might need some of the values of neigh_parms, so
populate them before calling it.
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/neighbour.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index b7de821f98df..576d46f4a69e 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1441,16 +1441,18 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, | |||
1441 | atomic_set(&p->refcnt, 1); | 1441 | atomic_set(&p->refcnt, 1); |
1442 | p->reachable_time = | 1442 | p->reachable_time = |
1443 | neigh_rand_reach_time(p->base_reachable_time); | 1443 | neigh_rand_reach_time(p->base_reachable_time); |
1444 | dev_hold(dev); | ||
1445 | p->dev = dev; | ||
1446 | write_pnet(&p->net, hold_net(net)); | ||
1447 | p->sysctl_table = NULL; | ||
1444 | 1448 | ||
1445 | if (ops->ndo_neigh_setup && ops->ndo_neigh_setup(dev, p)) { | 1449 | if (ops->ndo_neigh_setup && ops->ndo_neigh_setup(dev, p)) { |
1450 | release_net(net); | ||
1451 | dev_put(dev); | ||
1446 | kfree(p); | 1452 | kfree(p); |
1447 | return NULL; | 1453 | return NULL; |
1448 | } | 1454 | } |
1449 | 1455 | ||
1450 | dev_hold(dev); | ||
1451 | p->dev = dev; | ||
1452 | write_pnet(&p->net, hold_net(net)); | ||
1453 | p->sysctl_table = NULL; | ||
1454 | write_lock_bh(&tbl->lock); | 1456 | write_lock_bh(&tbl->lock); |
1455 | p->next = tbl->parms.next; | 1457 | p->next = tbl->parms.next; |
1456 | tbl->parms.next = p; | 1458 | tbl->parms.next = p; |