linux/drivers/infiniband/ulp/ipoib
Shalom Lagziel 9c6f42e925 IB/ipoib: Fix sysfs Pkey create<->remove possible deadlock
A possible ABBA lock can happen with RTNL and vlan_rwsem.
For example:

Flow A: Device Flush
	__ipoib_ib_dev_flush
	down_read(vlan_rwsem) 			// Lock A
	ipoib_flush_ah
	flush_workqueue(priv->wq) 		// Wait for completion
	A work on shared WQ (Mcast carrier)
		ipoib_mcast_carrier_on_task
		while (!rtnl_trylock())         // Wait for lock B

Flow B: Sysfs PKEY delete
	ipoib_vlan_delete
	lock(RTNL) 				// Lock B
	down_write(vlan_rwsem) 			// Wait for lock A

This can happen with PKEY creates as well. The solution is to release
the RTNL lock in sysfs functions in case it is not possible to lock
VLAN RW semaphore and reset the SYS call.

Fixes: 69956d8326 ("IB/ipoib: Sync between remove_one to sysfs calls that use rtnl_lock")
Signed-off-by: Shalom Lagziel <shaloml@mellanox.com>
Signed-off-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2017-09-25 11:47:23 -04:00
..
ipoib_cm.c IB/ipoib: Suppress the retry related completion errors 2017-09-22 13:12:36 -04:00
ipoib_ethtool.c Merge branch 'k.o/for-4.13-rc' into k.o/for-next 2017-08-18 14:12:04 -04:00
ipoib_fs.c IB/SA: Add OPA path record type 2017-05-01 14:39:02 -04:00
ipoib_ib.c IB/ipoib: Notify on modify QP failure only when relevant 2017-07-23 10:52:00 +03:00
ipoib_main.c Merge branch 'mellanox' into k.o/for-next 2017-08-24 20:25:15 -04:00
ipoib_multicast.c IB/ipoib: Make sure no in-flight joins while leaving that mcast 2017-07-23 09:45:11 +03:00
ipoib_netlink.c net: add netlink_ext_ack argument to rtnl_link_ops.changelink 2017-06-26 23:13:22 -04:00
ipoib_verbs.c IB/IPoIB: Support acceleration options callbacks 2017-04-20 15:19:44 -04:00
ipoib_vlan.c IB/ipoib: Fix sysfs Pkey create<->remove possible deadlock 2017-09-25 11:47:23 -04:00
ipoib.h IB/ipoib: Sync between remove_one to sysfs calls that use rtnl_lock 2017-08-24 16:31:08 -04:00
Kconfig kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT 2011-01-20 17:02:05 -08:00
Makefile IB/ipoib: Add rtnl_link_ops support 2012-09-20 16:49:17 -04:00