decnet: handle a failure in neigh_parms_alloc
Subsystems (2)
PATCH 1/1 decnet: handle a failure in neigh_parms_alloc
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.
--- net/decnet/dn_dev.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
net/decnet/dn_dev.c +5 -0
@@ -1149,6 +1149,11 @@ struct dn_dev *dn_dev_create(struct net_device *dev, int *err) } 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 ; + }dn_dev_sysctl_register (dev, &dn_db->parms);
Signature · 1 line
1.4.4.1.g278f
David Miller
maintainerFrom: [email protected] (Eric W. Biederman)
Date: Wed, 24 Jan 2007 13:09:40 -0700
Quoted 7 lines
While enhancing the neighbour code to handle multiple network namespaces I noticed that decnet is assuming
neigh_parms_allocwill allways succeed, which is clearly wrong. So handle the failure.Signed-off-by Eric W. Biederman <[email protected]>
I don't think this one is correct.
During failure cleanup you also have to invoke the neighbour parms ->down() operation if present, else you leave multicast entries on the ethernet device for example.
David Miller
maintainerFrom: David Miller <[email protected]>
Date: Wed, 24 Jan 2007 14:45:11 -0800 (PST)
Quoted 9 lines
From: [email protected] (Eric W. Biederman)
Date: Wed, 24 Jan 2007 13:09:40 -0700Quoted 6 lines
While enhancing the neighbour code to handle multiple network namespaces I noticed that decnet is assuming
neigh_parms_allocwill allways succeed, which is clearly wrong. So handle the failure.
Quoted 7 lines
Quoted 1 line
Signed-off-by Eric W. Biederman <[email protected]>I don't think this one is correct.
During failure cleanup you also have to invoke the neighbour parms ->down() operation if present, else you leave multicast entries on the ethernet device for example.
BTW, it occurs to me that a good way to handle this might be to try and do the neigh_parms_alloc() before running the ->up() method.
PATCH 1/1 net: 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.
--- net/decnet/dn_dev.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
net/decnet/dn_dev.c +9 -2
@@ -1140,16 +1140,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);
Signature · 1 line
1.4.4.1.g278f
Re: [PATCH] net: decnet handle a failure in neigh_parms_alloc (take 2)
Hi,
Quoted 7 lines · Eric W. Biederman
While enhancing the neighbour code to handle multiple network namespaces I noticed that decnet is assuming
neigh_parms_allocwill allways succeed, which is clearly wrong. So handle the failure.Signed-off-by Eric W. Biederman <[email protected]>
Also you should cc Patrick as he is now the maintainer,
Steve.
Quoted 37 lines
--- net/decnet/dn_dev.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)net/decnet/dn_dev.c +9
-2@@ -1140,16 +1140,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);Signature · 1 line
1.4.4.1.g278f
Re: [PATCH] net: decnet handle a failure in neigh_parms_alloc (take 2)
From: Steven Whitehouse <[email protected]>
Date: Thu, 25 Jan 2007 11:43:18 +0000
Quoted 11 lines
Hi,
Quoted 7 lines · Eric W. Biederman
While enhancing the neighbour code to handle multiple network namespaces I noticed that decnet is assuming
neigh_parms_allocwill allways succeed, which is clearly wrong. So handle the failure.Signed-off-by Eric W. Biederman <[email protected]>
Applied, thanks everyone.
Quoted 1 line
Also you should cc Patrick as he is now the maintainer,
Yep, would be a good idea in the future.