======================================================
WARNING: possible circular locking dependency detected
6.1.131-syzkaller #0 Not tainted
------------------------------------------------------
syz.1.2420/11674 is trying to acquire lock:
ffff8880503d4d00 (team->team_lock_key#12){+.+.}-{3:3}, at: team_del_slave+0x2e/0x1c0 drivers/net/team/team.c:2009

but task is already holding lock:
ffff888076d487c8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: nl80211_del_interface+0x112/0x130 net/wireless/nl80211.c:4368

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&rdev->wiphy.mtx){+.+.}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
       wiphy_lock include/net/cfg80211.h:5639 [inline]
       ieee80211_open+0x13a/0x1f0 net/mac80211/iface.c:458
       __dev_open+0x2cb/0x440 net/core/dev.c:1488
       dev_open+0xaa/0x1a0 net/core/dev.c:1524
       team_port_add drivers/net/team/team.c:1225 [inline]
       team_add_slave+0xa22/0x28f0 drivers/net/team/team.c:1995
       do_set_master net/core/rtnetlink.c:2627 [inline]
       do_setlink+0xf84/0x4060 net/core/rtnetlink.c:2837
       __rtnl_newlink net/core/rtnetlink.c:3605 [inline]
       rtnl_newlink+0x1736/0x2060 net/core/rtnetlink.c:3652
       rtnetlink_rcv_msg+0x822/0x1000 net/core/rtnetlink.c:6150
       netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2493
       netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline]
       netlink_unicast+0x7e2/0x970 net/netlink/af_netlink.c:1337
       netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1859
       sock_sendmsg_nosec net/socket.c:718 [inline]
       __sock_sendmsg net/socket.c:730 [inline]
       ____sys_sendmsg+0x5d3/0x9a0 net/socket.c:2519
       ___sys_sendmsg net/socket.c:2573 [inline]
       __sys_sendmsg+0x2a9/0x390 net/socket.c:2602
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (team->team_lock_key#12){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
       team_del_slave+0x2e/0x1c0 drivers/net/team/team.c:2009
       team_device_event+0x269/0x570 drivers/net/team/team.c:3054
       notifier_call_chain kernel/notifier.c:87 [inline]
       raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:455
       call_netdevice_notifiers_extack net/core/dev.c:2039 [inline]
       call_netdevice_notifiers net/core/dev.c:2053 [inline]
       unregister_netdevice_many+0xe48/0x1710 net/core/dev.c:10978
       unregister_netdevice_queue+0x2e6/0x350 net/core/dev.c:10909
       unregister_netdevice include/linux/netdevice.h:3075 [inline]
       _cfg80211_unregister_wdev+0x175/0x590 net/wireless/core.c:1205
       ieee80211_if_remove+0x1cc/0x2d0 net/mac80211/iface.c:2327
       ieee80211_del_iface+0x15/0x20 net/mac80211/cfg.c:202
       rdev_del_virtual_intf net/wireless/rdev-ops.h:62 [inline]
       cfg80211_remove_virtual_intf+0x270/0x490 net/wireless/util.c:2584
       genl_family_rcv_msg_doit net/netlink/genetlink.c:756 [inline]
       genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
       genl_rcv_msg+0xbfa/0xf50 net/netlink/genetlink.c:850
       netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2493
       genl_rcv+0x24/0x40 net/netlink/genetlink.c:861
       netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline]
       netlink_unicast+0x7e2/0x970 net/netlink/af_netlink.c:1337
       netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1859
       sock_sendmsg_nosec net/socket.c:718 [inline]
       __sock_sendmsg net/socket.c:730 [inline]
       ____sys_sendmsg+0x5d3/0x9a0 net/socket.c:2519
       ___sys_sendmsg net/socket.c:2573 [inline]
       __sys_sendmsg+0x2a9/0x390 net/socket.c:2602
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&rdev->wiphy.mtx);
                               lock(team->team_lock_key#12);
                               lock(&rdev->wiphy.mtx);
  lock(team->team_lock_key#12);

 *** DEADLOCK ***

3 locks held by syz.1.2420/11674:
 #0: ffffffff8e5b14f0 (cb_lock){++++}-{3:3}, at: genl_rcv+0x15/0x40 net/netlink/genetlink.c:860
 #1: ffffffff8e5505a8 (rtnl_mutex){+.+.}-{3:3}, at: nl80211_pre_doit+0x5b/0x8b0 net/wireless/nl80211.c:16235
 #2: ffff888076d487c8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: nl80211_del_interface+0x112/0x130 net/wireless/nl80211.c:4368

stack backtrace:
CPU: 1 PID: 11674 Comm: syz.1.2420 Not tainted 6.1.131-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
 team_del_slave+0x2e/0x1c0 drivers/net/team/team.c:2009
 team_device_event+0x269/0x570 drivers/net/team/team.c:3054
 notifier_call_chain kernel/notifier.c:87 [inline]
 raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:455
 call_netdevice_notifiers_extack net/core/dev.c:2039 [inline]
 call_netdevice_notifiers net/core/dev.c:2053 [inline]
 unregister_netdevice_many+0xe48/0x1710 net/core/dev.c:10978
 unregister_netdevice_queue+0x2e6/0x350 net/core/dev.c:10909
 unregister_netdevice include/linux/netdevice.h:3075 [inline]
 _cfg80211_unregister_wdev+0x175/0x590 net/wireless/core.c:1205
 ieee80211_if_remove+0x1cc/0x2d0 net/mac80211/iface.c:2327
 ieee80211_del_iface+0x15/0x20 net/mac80211/cfg.c:202
 rdev_del_virtual_intf net/wireless/rdev-ops.h:62 [inline]
 cfg80211_remove_virtual_intf+0x270/0x490 net/wireless/util.c:2584
 genl_family_rcv_msg_doit net/netlink/genetlink.c:756 [inline]
 genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
 genl_rcv_msg+0xbfa/0xf50 net/netlink/genetlink.c:850
 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2493
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:861
 netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline]
 netlink_unicast+0x7e2/0x970 net/netlink/af_netlink.c:1337
 netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1859
 sock_sendmsg_nosec net/socket.c:718 [inline]
 __sock_sendmsg net/socket.c:730 [inline]
 ____sys_sendmsg+0x5d3/0x9a0 net/socket.c:2519
 ___sys_sendmsg net/socket.c:2573 [inline]
 __sys_sendmsg+0x2a9/0x390 net/socket.c:2602
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f1f3d58d169
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f1f3e4d2038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f1f3d7a5fa0 RCX: 00007f1f3d58d169
RDX: 0000000000000000 RSI: 0000200000000200 RDI: 0000000000000003
RBP: 00007f1f3d60e2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f1f3d7a5fa0 R15: 00007ffc823f9fc8
 </TASK>
team0: Port device wlan1 removed