Skip to content

Commit

Permalink
[DECNET]: Handle a failure in neigh_parms_alloc (take 2)
Browse files Browse the repository at this point in the history
While enhancing the neighbour code to handle multiple network
namespaces I noticed that decnet is assuming neigh_parms_alloc
will allways succeed, which is clearly wrong.  So handle the
failure.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Steven Whitehouse <steve@chygwyn.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric W. Biederman authored and David S. Miller committed Jan 25, 2007
1 parent 24cb230 commit 95743de
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions net/decnet/dn_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,16 +1145,23 @@ struct dn_dev *dn_dev_create(struct net_device *dev, int *err)
init_timer(&dn_db->timer);

dn_db->uptime = jiffies;

dn_db->neigh_parms = neigh_parms_alloc(dev, &dn_neigh_table);
if (!dn_db->neigh_parms) {
dev->dn_ptr = NULL;
kfree(dn_db);
return NULL;
}

if (dn_db->parms.up) {
if (dn_db->parms.up(dev) < 0) {
neigh_parms_release(&dn_neigh_table, dn_db->neigh_parms);
dev->dn_ptr = NULL;
kfree(dn_db);
return NULL;
}
}

dn_db->neigh_parms = neigh_parms_alloc(dev, &dn_neigh_table);

dn_dev_sysctl_register(dev, &dn_db->parms);

dn_dev_set_timer(dev);
Expand Down

0 comments on commit 95743de

Please sign in to comment.