diff options
-rw-r--r-- | net/core/neighbour.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 19c0dd12fd58..62d47841c67d 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1291,10 +1291,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, | |||
1291 | struct neigh_parms *p, *ref; | 1291 | struct neigh_parms *p, *ref; |
1292 | struct net *net; | 1292 | struct net *net; |
1293 | 1293 | ||
1294 | net = &init_net; | 1294 | net = dev->nd_net; |
1295 | if (dev) | ||
1296 | net = dev->nd_net; | ||
1297 | |||
1298 | ref = lookup_neigh_params(tbl, net, 0); | 1295 | ref = lookup_neigh_params(tbl, net, 0); |
1299 | if (!ref) | 1296 | if (!ref) |
1300 | return NULL; | 1297 | return NULL; |
@@ -1306,15 +1303,14 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, | |||
1306 | INIT_RCU_HEAD(&p->rcu_head); | 1303 | INIT_RCU_HEAD(&p->rcu_head); |
1307 | p->reachable_time = | 1304 | p->reachable_time = |
1308 | neigh_rand_reach_time(p->base_reachable_time); | 1305 | neigh_rand_reach_time(p->base_reachable_time); |
1309 | if (dev) { | ||
1310 | if (dev->neigh_setup && dev->neigh_setup(dev, p)) { | ||
1311 | kfree(p); | ||
1312 | return NULL; | ||
1313 | } | ||
1314 | 1306 | ||
1315 | dev_hold(dev); | 1307 | if (dev->neigh_setup && dev->neigh_setup(dev, p)) { |
1316 | p->dev = dev; | 1308 | kfree(p); |
1309 | return NULL; | ||
1317 | } | 1310 | } |
1311 | |||
1312 | dev_hold(dev); | ||
1313 | p->dev = dev; | ||
1318 | p->net = hold_net(net); | 1314 | p->net = hold_net(net); |
1319 | p->sysctl_table = NULL; | 1315 | p->sysctl_table = NULL; |
1320 | write_lock_bh(&tbl->lock); | 1316 | write_lock_bh(&tbl->lock); |