Skip to content

Commit

Permalink
[ARP]: Move inet_addr_type call after simple error checks in arp_cont…
Browse files Browse the repository at this point in the history
…ructor.

The neighbour entry will be destroyed in the case of error, so it is
pointless to perform constly routing table lookup in this case.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Denis V. Lunev authored and David S. Miller committed Jan 28, 2008
1 parent a308da1 commit a79878f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/ipv4/arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,15 @@ static int arp_constructor(struct neighbour *neigh)
struct in_device *in_dev;
struct neigh_parms *parms;

neigh->type = inet_addr_type(&init_net, addr);

rcu_read_lock();
in_dev = __in_dev_get_rcu(dev);
if (in_dev == NULL) {
rcu_read_unlock();
return -EINVAL;
}

neigh->type = inet_addr_type(&init_net, addr);

parms = in_dev->arp_parms;
__neigh_parms_put(neigh->parms);
neigh->parms = neigh_parms_clone(parms);
Expand Down

0 comments on commit a79878f

Please sign in to comment.