ipv6: Fix potential hang in mif6_add
Subsystems (3)
RFC PATCH 1/1 ipv6: Fix potential hang in mif6_add
Fix a potential "waiting for %s to become free" hang. mif6_add() called ip6mr_reg_vif to allocate/register a netdevice, which also took an extra reference on the device. On error, mif6_add should drop this reference before unregistering the device.
(untested, noticed from code walkthrough)
--- net/ipv6/ip6mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6mr.c +1 -1
@@ -937,8 +937,8 @@ static int mif6_add(struct net *net, strreturn -ENOBUFS ; err =dev_set_allmulti (dev,1 );if (err) { -unregister_netdevice (dev);dev_put (dev); +unregister_netdevice (dev);return err; }break ;
Quoted 18 lines · Krishna Kumar
Fix a potential "waiting for %s to become free" hang.
mif6_add()calledip6mr_reg_vifto allocate/register a netdevice, which also took an extra reference on the device. On error,mif6_addshould drop this reference before unregistering the device.(untested, noticed from code walkthrough)
Signed-off-by Krishna Kumar <[email protected]>--- net/ipv6/ip6mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff -ruNp
org/net/ipv6/ip6mr.cnew/net/ipv6/ip6mr.c
net/ipv6/ip6mr.c static int mif6_add(struct net *net, str · line 944
Quoted 9 lines
net/ipv6/ip6mr.c +1
-1@@ -937,8 +937,8 @@ static int mif6_add(struct net *net, strreturn -ENOBUFS ; err =dev_set_allmulti (dev,1 );if (err) { -unregister_netdevice (dev);dev_put (dev); +unregister_netdevice (dev);return err; }break ;
This makes no difference to dev_put() before or after unregister_netdevice() because we hold RTNL in mif6_add()