|
@@ -127,9 +127,6 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
|
|
|
|
|
|
ppriv = ipoib_priv(pdev);
|
|
|
|
|
|
- if (test_bit(IPOIB_FLAG_GOING_DOWN, &ppriv->flags))
|
|
|
- return -EPERM;
|
|
|
-
|
|
|
snprintf(intf_name, sizeof(intf_name), "%s.%04x",
|
|
|
ppriv->dev->name, pkey);
|
|
|
|
|
@@ -141,6 +138,12 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
|
|
|
return restart_syscall();
|
|
|
}
|
|
|
|
|
|
+ if (pdev->reg_state != NETREG_REGISTERED) {
|
|
|
+ rtnl_unlock();
|
|
|
+ mutex_unlock(&ppriv->sysfs_mutex);
|
|
|
+ return -EPERM;
|
|
|
+ }
|
|
|
+
|
|
|
if (!down_write_trylock(&ppriv->vlan_rwsem)) {
|
|
|
rtnl_unlock();
|
|
|
mutex_unlock(&ppriv->sysfs_mutex);
|
|
@@ -199,9 +202,6 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
|
|
|
|
|
|
ppriv = ipoib_priv(pdev);
|
|
|
|
|
|
- if (test_bit(IPOIB_FLAG_GOING_DOWN, &ppriv->flags))
|
|
|
- return -EPERM;
|
|
|
-
|
|
|
if (!mutex_trylock(&ppriv->sysfs_mutex))
|
|
|
return restart_syscall();
|
|
|
|
|
@@ -210,6 +210,12 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
|
|
|
return restart_syscall();
|
|
|
}
|
|
|
|
|
|
+ if (pdev->reg_state != NETREG_REGISTERED) {
|
|
|
+ rtnl_unlock();
|
|
|
+ mutex_unlock(&ppriv->sysfs_mutex);
|
|
|
+ return -EPERM;
|
|
|
+ }
|
|
|
+
|
|
|
if (!down_write_trylock(&ppriv->vlan_rwsem)) {
|
|
|
rtnl_unlock();
|
|
|
mutex_unlock(&ppriv->sysfs_mutex);
|