Skip to contentSkip to conversation

ipv6: Fix "waiting for %s to become free" hang

PATCH In review Krishna Kumar 2 participants 3 messages Dec 4, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6: Fix "waiting for %s to become free" hang

From: Krishna Kumar <[email protected]>

(From code-walkthrough, and untested)

Fix "waiting for %s to become free" hang. dev has an extra hold (by ip6mr_reg_vif) which was not dropped before calling unregister_netdevice.

---
 net/ipv6/ip6mr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6mr.c +1 -1
diff -ruNp org/net/ipv6/ip6mr.c new/net/ipv6/ip6mr.c
@@ -648,8 +648,8 @@ static int mif6_add(struct net *net, str
 			return -ENOBUFS;
 		err = dev_set_allmulti(dev, 1);
 		if (err) {
-			unregister_netdevice(dev);
 			dev_put(dev);
+			unregister_netdevice(dev);
 			return err;
 		}
 		break;
#1 lore raw
Quoted 17 lines · Krishna Kumar

From: Krishna Kumar <[email protected]>

(From code-walkthrough, and untested)

Fix "waiting for %s to become free" hang. dev has an extra hold (by ip6mr_reg_vif) which was not dropped before calling unregister_netdevice.

---
 net/ipv6/ip6mr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -ruNp org/net/ipv6/ip6mr.c new/net/ipv6/ip6mr.c

net/ipv6/ip6mr.c static int mif6_add(struct net *net, str · line 655

Quoted 9 lines
net/ipv6/ip6mr.c +1 -1
@@ -648,8 +648,8 @@ static int mif6_add(struct net *net, str
 			return -ENOBUFS;
 		err = dev_set_allmulti(dev, 1);
 		if (err) {
-			unregister_netdevice(dev);
 			dev_put(dev);
+			unregister_netdevice(dev);
 			return err;
 		}
 		break;

This changes nothing, since we hold rtnl at this point.

unregister_netdevice() only queues the device (net_set_todo()) in a list.

And we process this list later, when renl_unlock() is finally called.

#2 lore raw
Quoted 34 lines

Eric Dumazet <[email protected]>

Re: [PATCH] ipv6: Fix "waiting for %s to become free" hang

Quoted 17 lines · Krishna Kumar

From: Krishna Kumar <[email protected]>

(From code-walkthrough, and untested)

Fix "waiting for %s to become free" hang. dev has an extra hold (by ip6mr_reg_vif) which was not dropped before calling unregister_netdevice.

---
 net/ipv6/ip6mr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -ruNp org/net/ipv6/ip6mr.c new/net/ipv6/ip6mr.c

net/ipv6/ip6mr.c 2009-12-04 16:09:56.000000000 +0530 static int mif6_add(struct net *net, str · line 655

Quoted 9 lines
net/ipv6/ip6mr.c 2009-12-04 16:09:56.000000000 +0530 renamed from net/ipv6/ip6mr.c 2009-12-04 16:08:07.000000000 +0530 +1 -1
@@ -648,8 +648,8 @@ static int mif6_add(struct net *net, str
          return -ENOBUFS;
       err = dev_set_allmulti(dev, 1);
       if (err) {
-         unregister_netdevice(dev);
          dev_put(dev);
+         unregister_netdevice(dev);
          return err;
       }
       break;

This changes nothing, since we hold rtnl at this point.

Quoted 3 lines

unregister_netdevice() only queues the device (net_set_todo()) in a list.

And we process this list later, when renl_unlock() is finally called.

Yes, you are right. I sent the patch on my memory of unregister_netdev, which gets
the rtnl and drops it, and that would have caused this problem. Please drop the patch.

thanks,

- KK