Commit 486b51d3 authored by Denis V. Lunev's avatar Denis V. Lunev Committed by David S. Miller

[ARP]: Remove overkill checks from neigh_param_alloc.

Valid network device is always passed into neigh_param_alloc, so
remove extra checking for dev == NULL. Additionally, cleanup bogus
netns assignment.
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 72132c1b
...@@ -1291,10 +1291,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, ...@@ -1291,10 +1291,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
struct neigh_parms *p, *ref; struct neigh_parms *p, *ref;
struct net *net; struct net *net;
net = &init_net;
if (dev)
net = dev->nd_net; net = dev->nd_net;
ref = lookup_neigh_params(tbl, net, 0); ref = lookup_neigh_params(tbl, net, 0);
if (!ref) if (!ref)
return NULL; return NULL;
...@@ -1306,7 +1303,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, ...@@ -1306,7 +1303,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
INIT_RCU_HEAD(&p->rcu_head); INIT_RCU_HEAD(&p->rcu_head);
p->reachable_time = p->reachable_time =
neigh_rand_reach_time(p->base_reachable_time); neigh_rand_reach_time(p->base_reachable_time);
if (dev) {
if (dev->neigh_setup && dev->neigh_setup(dev, p)) { if (dev->neigh_setup && dev->neigh_setup(dev, p)) {
kfree(p); kfree(p);
return NULL; return NULL;
...@@ -1314,7 +1311,6 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, ...@@ -1314,7 +1311,6 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
dev_hold(dev); dev_hold(dev);
p->dev = dev; p->dev = dev;
}
p->net = hold_net(net); p->net = hold_net(net);
p->sysctl_table = NULL; p->sysctl_table = NULL;
write_lock_bh(&tbl->lock); write_lock_bh(&tbl->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment