summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorVeaceslav Falico <vfalico@redhat.com>2013-08-02 19:07:38 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-14 06:02:08 -0700
commit3b5c0012686fac17b4fac1c11fba65f45bbdbff8 (patch)
tree18d8c5c0ef80c748318b48d219c78daecc7f6493 /net
parentdbe3f7527fa31ccdb0aff8635dc03124f487a1f4 (diff)
downloadkernel-common-3b5c0012686fac17b4fac1c11fba65f45bbdbff8.tar.gz
kernel-common-3b5c0012686fac17b4fac1c11fba65f45bbdbff8.tar.bz2
kernel-common-3b5c0012686fac17b4fac1c11fba65f45bbdbff8.zip
neighbour: populate neigh_parms on alloc before calling ndo_neigh_setup
[ Upstream commit 63134803a6369dcf7dddf7f0d5e37b9566b308d2 ] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/core/neighbour.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 69b7ca35c461..ebd4b21cb9d4 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1442,16 +1442,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;