Commit 1a82d19c authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by Paolo Abeni
Browse files

be2net: fix sleeping while atomic bugs in be_ndo_bridge_getlink

Partially revert commit b7172414 ("be2net: replace polling with
sleeping in the FW completion path") w.r.t mcc mutex it introduces and the
use of usleep_range. The be2net be_ndo_bridge_getlink() callback is
called with rcu_read_lock, so this code has been broken for a long time.
Both the mutex_lock and the usleep_range can cause the issue Ian Kumlien
reported[1]. The call path is:
be_ndo_bridge_getlink -> be_cmd_get_hsw_config -> be_mcc_notify_wait ->
be_mcc_wait_compl -> usleep_range()

[1] https://lore.kernel.org/netdev/CAA85sZveppNgEVa_FD+qhOMtG_AavK9_mFiU+jWrMtXmwqefGA@mail.gmail.com/



Tested-by: default avatarIan Kumlien <ian.kumlien@gmail.com>
Fixes: b7172414 ("be2net: replace polling with sleeping in the FW completion path")
Signed-off-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/20250227164129.1201164-1-razor@blackwall.org


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 64e6a754
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -562,7 +562,7 @@ struct be_adapter {
	struct be_dma_mem mbox_mem_alloced;

	struct be_mcc_obj mcc_obj;
	struct mutex mcc_lock;	/* For serializing mcc cmds to BE card */
	spinlock_t mcc_lock;	/* For serializing mcc cmds to BE card */
	spinlock_t mcc_cq_lock;

	u16 cfg_num_rx_irqs;		/* configured via set-channels */
+98 −99

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -5667,8 +5667,8 @@ static int be_drv_init(struct be_adapter *adapter)
	}

	mutex_init(&adapter->mbox_lock);
	mutex_init(&adapter->mcc_lock);
	mutex_init(&adapter->rx_filter_lock);
	spin_lock_init(&adapter->mcc_lock);
	spin_lock_init(&adapter->mcc_cq_lock);
	init_completion(&adapter->et_cmd_compl);