diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2009-05-13 17:01:51 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-19 05:15:59 (GMT) |
commit | 26574401fef6766f6c3ca25b5c13febe662d2a32 (patch) | |
tree | f3ef9fe491dbdece50d77ccc56bb797727b91375 /drivers/infiniband/ulp/ipoib/ipoib_vlan.c | |
parent | af38f2989572704a846a5577b5ab3b1e2885cbfb (diff) | |
download | linux-26574401fef6766f6c3ca25b5c13febe662d2a32.tar.xz |
net: Fix ipoib rtnl_lock sysfs deadlock.
Network device sysfs files that grab the rtnl_lock unconditionally
will deadlock if accessed when the network device is being
unregistered. So use trylock and syscall_restart to avoid this
deadlock.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/infiniband/ulp/ipoib/ipoib_vlan.c')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c index 4c57f32..e3bf00d8 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c @@ -61,7 +61,8 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) ppriv = netdev_priv(pdev); - rtnl_lock(); + if (!rtnl_trylock()) + return restart_syscall(); mutex_lock(&ppriv->vlan_mutex); /* @@ -167,7 +168,8 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey) ppriv = netdev_priv(pdev); - rtnl_lock(); + if (!rtnl_trylock()) + return restart_syscall(); mutex_lock(&ppriv->vlan_mutex); list_for_each_entry_safe(priv, tpriv, &ppriv->child_intfs, list) { if (priv->pkey == pkey) { |