IPoIB: Fix deadlock between ipoib_open() and child interface create
authorRoland Dreier <rolandd@cisco.com>
Thu, 15 Jan 2009 05:44:39 +0000 (21:44 -0800)
committerRoland Dreier <rolandd@cisco.com>
Thu, 15 Jan 2009 05:44:39 +0000 (21:44 -0800)
commitcbbe1efa4972350286b52cb48aefaa11e198c0fb
treeddcfdea04829b9d2f84b0e9d6a9adc6eb86a5f13
parentb8a1b1ce14252b59b2d5c89de25b54f9bfd4cc5e
IPoIB: Fix deadlock between ipoib_open() and child interface create

Fix a deadlock between child interface creation/deletion and ipoib
start/stop.  The former takes vlan_mutex, and then might take RTNL via
register_netdev()/unregister_netdev().  The latter is executed with
RTNL held, and tries to take vlan_mutex, which can lead to an AB-BA
deadlock.

Fix this by having the child interface creation/deletion code take the
RTNL first so vlan_mutex always nests inside RTNL.  We can use
register_netdevice() for child interfaces because we form the
interface name from the parent interface and hence don't need the '%'
expansion of register_netdev().

Reported-by: Yossi Etigin <yosefe@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/ulp/ipoib/ipoib_vlan.c