Re: [syzbot] [net?] possible deadlock in hsr_dev_xmit (2)

From: Hillf Danton
Date: Mon Apr 01 2024 - 09:04:36 EST


On Sun, 31 Mar 2024 23:11:27 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 480e035fc4c7 Merge tag 'drm-next-2024-03-13' of https://gi..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15e0f5c3180000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 480e035fc4c7

--- x/net/hsr/hsr_device.c
+++ y/net/hsr/hsr_device.c
@@ -226,9 +226,11 @@ static netdev_tx_t hsr_dev_xmit(struct s
skb->dev = master->dev;
skb_reset_mac_header(skb);
skb_reset_mac_len(skb);
- spin_lock_bh(&hsr->seqnr_lock);
+ local_bh_disable();
+ spin_lock_nested(&hsr->seqnr_lock, 1);
hsr_forward_skb(skb, master);
- spin_unlock_bh(&hsr->seqnr_lock);
+ spin_unlock(&hsr->seqnr_lock);
+ local_bh_enable();
} else {
dev_core_stats_tx_dropped_inc(dev);
dev_kfree_skb_any(skb);
--