diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2007-01-25 15:51:51 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-01-25 15:51:51 -0800 |
commit | 95743deb34de29defbb98ad477700aaf344f93f3 (patch) | |
tree | abc0e49488dcc4e36bdb0f3d211a6cd5a5be0544 /net/decnet/dn_dev.c | |
parent | 24cb230b587cf3aad8794b150682d8d8303a2120 (diff) | |
download | kernel_goldelico_gta04-95743deb34de29defbb98ad477700aaf344f93f3.zip kernel_goldelico_gta04-95743deb34de29defbb98ad477700aaf344f93f3.tar.gz kernel_goldelico_gta04-95743deb34de29defbb98ad477700aaf344f93f3.tar.bz2 |
[DECNET]: Handle a failure in neigh_parms_alloc (take 2)
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>
Diffstat (limited to 'net/decnet/dn_dev.c')
-rw-r--r-- | net/decnet/dn_dev.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index fc6f3c0..ed083ab 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c @@ -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); |