Commit d2356f8f authored by Junxian Huang's avatar Junxian Huang Committed by Chengchang Tang
Browse files

RDMA/hns: Fix a potential Sleep-in-Atomic-Context

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAL7SX



----------------------------------------------------------------------

In hns_roce_get_bond_netdev(), a bond_mutex is locked. This may lead to
a potential Sleep-in-Atomic-Context along with the iboe.lock in
hns_roce_query_port().

Since hns_roce_get_bond_netdev() doesn't involve iboe, move the call out
of the critical section of iboe.lock.

Fixes: e62a2027 ("RDMA/hns: support RoCE bonding")
Signed-off-by: default avatarJunxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: default avatarXinghai Cen <cenxinghai@h-partners.com>
parent 6c966b51
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -341,9 +341,10 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u8 port_num,
	if (ret)
		ibdev_warn(ib_dev, "failed to get speed, ret = %d.\n", ret);

	net_dev = hr_dev->hw->get_bond_netdev(hr_dev);

	spin_lock_irqsave(&hr_dev->iboe.lock, flags);

	net_dev = hr_dev->hw->get_bond_netdev(hr_dev);
	if (!net_dev)
		net_dev = get_hr_netdev(hr_dev, port);
	if (!net_dev) {