|
@@ -334,13 +334,16 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port,
|
|
|
|
|
|
|
|
usnic_dbg("\n");
|
|
usnic_dbg("\n");
|
|
|
|
|
|
|
|
- mutex_lock(&us_ibdev->usdev_lock);
|
|
|
|
|
if (ib_get_eth_speed(ibdev, port, &props->active_speed,
|
|
if (ib_get_eth_speed(ibdev, port, &props->active_speed,
|
|
|
- &props->active_width)) {
|
|
|
|
|
- mutex_unlock(&us_ibdev->usdev_lock);
|
|
|
|
|
|
|
+ &props->active_width))
|
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
+ * usdev_lock is acquired after (and not before) ib_get_eth_speed call
|
|
|
|
|
+ * because acquiring rtnl_lock in ib_get_eth_speed, while holding
|
|
|
|
|
+ * usdev_lock could lead to a deadlock.
|
|
|
|
|
+ */
|
|
|
|
|
+ mutex_lock(&us_ibdev->usdev_lock);
|
|
|
/* props being zeroed by the caller, avoid zeroing it here */
|
|
/* props being zeroed by the caller, avoid zeroing it here */
|
|
|
|
|
|
|
|
props->lid = 0;
|
|
props->lid = 0;
|