2007-02-03 02:43:56

by Chris Wright

[permalink] [raw]
Subject: [patch 47/59] DECNET: Handle a failure in neigh_parms_alloc (take 2)

-stable review patch. If anyone has any objections, please let us know.
------------------

From: Eric W. Biederman <[email protected]>

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 <[email protected]>
Acked-by: Steven Whitehouse <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Chris Wright <[email protected]>
---
net/decnet/dn_dev.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

--- linux-2.6.19.2.orig/net/decnet/dn_dev.c
+++ linux-2.6.19.2/net/decnet/dn_dev.c
@@ -1116,16 +1116,23 @@ struct dn_dev *dn_dev_create(struct net_
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);

--