linux/drivers/infiniband
Parvi Kaustubhi c0ce3a4076 IB/usnic: Fix potential deadlock
[ Upstream commit 8036e90f92 ]

Acquiring the rtnl lock while holding usdev_lock could result in a
deadlock.

For example:

usnic_ib_query_port()
| mutex_lock(&us_ibdev->usdev_lock)
 | ib_get_eth_speed()
  | rtnl_lock()

rtnl_lock()
| usnic_ib_netdevice_event()
 | mutex_lock(&us_ibdev->usdev_lock)

This commit moves the usdev_lock acquisition after the rtnl lock has been
released.

This is safe to do because usdev_lock is not protecting anything being
accessed in ib_get_eth_speed(). Hence, the correct order of holding locks
(rtnl -> usdev_lock) is not violated.

Signed-off-by: Parvi Kaustubhi <pkaustub@cisco.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2019-01-26 09:20:49 +01:00
..
core RDMA/nldev: Don't expose unsafe global rkey to regular user 2019-01-22 21:09:53 +01:00
hw IB/usnic: Fix potential deadlock 2019-01-26 09:20:49 +01:00
sw rxe: IB_WR_REG_MR does not capture MR's iova field 2019-01-26 09:20:43 +01:00
ulp RDMA/srpt: Fix a use-after-free in the channel release code 2019-01-13 09:24:08 +01:00
Kconfig RDMA: Fix building with CONFIG_MMU=n 2018-10-03 16:01:03 -06:00
Makefile IB/rdmavt: Create module framework and handle driver registration 2016-03-10 20:37:04 -05:00