Skip to content

Commit 9326a13

Browse files
ferasdgregkh
authored andcommitted
IB/ipoib: Fix deadlock over vlan_mutex
[ Upstream commit 1c3098cdb05207e740715857df7b0998e372f527 ] This patch fixes Deadlock while executing ipoib_vlan_delete. The function takes the vlan_rwsem semaphore and calls unregister_netdevice. The later function calls ipoib_mcast_stop_thread that cause workqueue flush. When the queue has one of the ipoib_ib_dev_flush_xxx events, a deadlock occur because these events also tries to catch the same vlan_rwsem semaphore. To fix, unregister_netdevice should be called after releasing the semaphore. Fixes: cbbe1ef ("IPoIB: Fix deadlock between ipoib_open() and child interface create") Signed-off-by: Feras Daoud <ferasda@mellanox.com> Signed-off-by: Erez Shitrit <erezsh@mellanox.com> Reviewed-by: Alex Vesker <valex@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 01b3db2 commit 9326a13

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/infiniband/ulp/ipoib/ipoib_vlan.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,18 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
185185
list_for_each_entry_safe(priv, tpriv, &ppriv->child_intfs, list) {
186186
if (priv->pkey == pkey &&
187187
priv->child_type == IPOIB_LEGACY_CHILD) {
188-
unregister_netdevice(priv->dev);
189188
list_del(&priv->list);
190189
dev = priv->dev;
191190
break;
192191
}
193192
}
194193
up_write(&ppriv->vlan_rwsem);
195194

195+
if (dev) {
196+
ipoib_dbg(ppriv, "delete child vlan %s\n", dev->name);
197+
unregister_netdevice(dev);
198+
}
199+
196200
rtnl_unlock();
197201

198202
if (dev) {

0 commit comments

Comments
 (0)