diff options
author | Veaceslav Falico <vfalico@redhat.com> | 2013-08-02 19:07:38 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-05 15:19:04 -0700 |
commit | fc7f8f5c53fdb82d4689e24df3da1a88bc3859f7 (patch) | |
tree | cb51b848381a414c2bbcf0a5bb4c104c39f30d3f /net/core | |
parent | 7921895a5e852fc99de347bc0600659997de9298 (diff) | |
download | op-kernel-dev-fc7f8f5c53fdb82d4689e24df3da1a88bc3859f7.zip op-kernel-dev-fc7f8f5c53fdb82d4689e24df3da1a88bc3859f7.tar.gz |
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 9232c68..60533db 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, atomic_set(&p->refcnt, 1); p->reachable_time = neigh_rand_reach_time(p->base_reachable_time); + dev_hold(dev); + p->dev = dev; + write_pnet(&p->net, hold_net(net)); + p->sysctl_table = NULL; if (ops->ndo_neigh_setup && ops->ndo_neigh_setup(dev, p)) { + release_net(net); + dev_put(dev); kfree(p); return NULL; } - dev_hold(dev); - p->dev = dev; - write_pnet(&p->net, hold_net(net)); - p->sysctl_table = NULL; write_lock_bh(&tbl->lock); p->next = tbl->parms.next; tbl->parms.next = p; |