[ofa-general] [PATCH] ipoib: fix free_netdev() BUG while deleting a vlan
Yossi Etigin
yosefe at Voltaire.COM
Mon Mar 30 10:37:56 PDT 2009
free_netdev() should be called after rtnl_lock is released.
Failing to to so might trigger an BUG in free_netdev() which asserts
that the device state is NETREG_UNREGISTERED.
Signed-off-by: Yossi Etigin <yosefe at voltaire.com>
--
Index: b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
===================================================================
--- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c 2009-03-10 18:21:47.000000000 +0200
+++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c 2009-03-30 20:18:29.000000000 +0300
@@ -147,7 +147,10 @@ register_failed:
ipoib_dev_cleanup(priv->dev);
device_init_failed:
+ mutex_unlock(&ppriv->vlan_mutex);
+ rtnl_unlock();
free_netdev(priv->dev);
+ return result;
err:
mutex_unlock(&ppriv->vlan_mutex);
@@ -158,7 +161,6 @@ err:
int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
{
struct ipoib_dev_priv *ppriv, *priv, *tpriv;
- int ret = -ENOENT;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
@@ -172,14 +174,15 @@ int ipoib_vlan_delete(struct net_device
unregister_netdevice(priv->dev);
ipoib_dev_cleanup(priv->dev);
list_del(&priv->list);
- free_netdev(priv->dev);
- ret = 0;
- break;
+ mutex_unlock(&ppriv->vlan_mutex);
+ rtnl_unlock();
+ free_netdev(priv->dev);
+ return 0;
}
}
mutex_unlock(&ppriv->vlan_mutex);
rtnl_unlock();
- return ret;
+ return -ENOENT;
}
More information about the general
mailing list