Commit faf2f459 authored by Junxian Huang's avatar Junxian Huang Committed by Juan Zhou
Browse files

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

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



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

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: 2004b3f9 ("RDMA/hns: Support RoCE bonding")
Signed-off-by: default avatarJunxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: default avatarJuan Zhou <zhoujuan51@h-partners.com>
parent d12310fd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -316,9 +316,10 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u32 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) {