[PATCH net-next 1/8] vxlan: Fix error handling while creating device.

Subsystems: networking drivers, the rest

STALE4826d

2 messages, 2 authors, 2013-06-20 · open the first message on its own page

[PATCH net-next 1/8] vxlan: Fix error handling while creating device.

From: Pravin B Shelar <hidden>
Date: 2013-06-20 07:26:33

Delete vxlan-sock list entry from list before freeing the memory.

Signed-off-by: Pravin B Shelar <redacted>
---
 drivers/net/vxlan.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 284c6c0..173705f 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1606,9 +1606,11 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
 	err = register_netdevice(dev);
 	if (err) {
 		if (--vs->refcnt == 0) {
+			hlist_del_rcu(&vs->hlist);
 			rtnl_unlock();
+
 			sk_release_kernel(vs->sock->sk);
-			kfree(vs);
+			kfree_rcu(vs, rcu);
 			rtnl_lock();
 		}
 		return err;
-- 
1.7.1

Re: [PATCH net-next 1/8] vxlan: Fix error handling while creating device.

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2013-06-20 15:47:51

On Thu, 20 Jun 2013 00:26:25 -0700
Pravin B Shelar [off-list ref] wrote:
quoted hunk
Delete vxlan-sock list entry from list before freeing the memory.

Signed-off-by: Pravin B Shelar <redacted>
---
 drivers/net/vxlan.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 284c6c0..173705f 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1606,9 +1606,11 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
 	err = register_netdevice(dev);
 	if (err) {
 		if (--vs->refcnt == 0) {
+			hlist_del_rcu(&vs->hlist);
 			rtnl_unlock();
+
 			sk_release_kernel(vs->sock->sk);
-			kfree(vs);
+			kfree_rcu(vs, rcu);
 			rtnl_lock();
 		}
 		return err;
This will not be necessary with my next patch set, that code all changes.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help