Skip to content

Commit ba729a9

Browse files
lxingregkh
authored andcommitted
net: thunderx: use spin_lock_bh in nicvf_set_rx_mode_task()
[ Upstream commit bab9693 ] A dead lock was triggered on thunderx driver: CPU0 CPU1 ---- ---- [01] lock(&(&nic->rx_mode_wq_lock)->rlock); [11] lock(&(&mc->mca_lock)->rlock); [12] lock(&(&nic->rx_mode_wq_lock)->rlock); [02] <Interrupt> lock(&(&mc->mca_lock)->rlock); The path for each is: [01] worker_thread() -> process_one_work() -> nicvf_set_rx_mode_task() [02] mld_ifc_timer_expire() [11] ipv6_add_dev() -> ipv6_dev_mc_inc() -> igmp6_group_added() -> [12] dev_mc_add() -> __dev_set_rx_mode() -> nicvf_set_rx_mode() To fix it, it needs to disable bh on [1], so that the timer on [2] wouldn't be triggered until rx_mode_wq_lock is released. So change to use spin_lock_bh() instead of spin_lock(). Thanks to Paolo for helping with this. v1->v2: - post to netdev. Reported-by: Rafael P. <rparrazo@redhat.com> Tested-by: Dean Nelson <dnelson@redhat.com> Fixes: 469998c ("net: thunderx: prevent concurrent data re-writing by nicvf_set_rx_mode") Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 786a936 commit ba729a9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/net/ethernet/cavium/thunder/nicvf_main.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,11 +2047,11 @@ static void nicvf_set_rx_mode_task(struct work_struct *work_arg)
20472047
/* Save message data locally to prevent them from
20482048
* being overwritten by next ndo_set_rx_mode call().
20492049
*/
2050-
spin_lock(&nic->rx_mode_wq_lock);
2050+
spin_lock_bh(&nic->rx_mode_wq_lock);
20512051
mode = vf_work->mode;
20522052
mc = vf_work->mc;
20532053
vf_work->mc = NULL;
2054-
spin_unlock(&nic->rx_mode_wq_lock);
2054+
spin_unlock_bh(&nic->rx_mode_wq_lock);
20552055

20562056
__nicvf_set_rx_mode_task(mode, mc, nic);
20572057
}

0 commit comments

Comments
 (0)