======================================================
WARNING: possible circular locking dependency detected
6.16.0-rc6-syzkaller-00411-g95993dc3039e-dirty #0 Not tainted
------------------------------------------------------
kworker/u9:3/1377 is trying to acquire lock:
ffff88803ddece00 (team->team_lock_key#2){+.+.}-{4:4}, at: team_port_change_check drivers/net/team/team_core.c:2966 [inline]
ffff88803ddece00 (team->team_lock_key#2){+.+.}-{4:4}, at: team_device_event+0x544/0xa20 drivers/net/team/team_core.c:2996

but task is already holding lock:
ffff888029958d30 (&dev_instance_lock_key#20){+.+.}-{4:4}, at: netdev_lock include/linux/netdevice.h:2756 [inline]
ffff888029958d30 (&dev_instance_lock_key#20){+.+.}-{4:4}, at: netdev_lock_ops include/net/netdev_lock.h:42 [inline]
ffff888029958d30 (&dev_instance_lock_key#20){+.+.}-{4:4}, at: __linkwatch_run_queue+0x4a0/0x7e0 net/core/link_watch.c:243

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&dev_instance_lock_key#20){+.+.}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       __mutex_lock_common kernel/locking/mutex.c:602 [inline]
       __mutex_lock+0x182/0xe80 kernel/locking/mutex.c:747
       netdev_lock include/linux/netdevice.h:2756 [inline]
       netdev_lock_ops include/net/netdev_lock.h:42 [inline]
       dev_set_mtu+0x10e/0x260 net/core/dev_api.c:247
       team_port_add drivers/net/team/team_core.c:1215 [inline]
       team_add_slave+0x8b8/0x2840 drivers/net/team/team_core.c:1989
       do_set_master+0x533/0x6d0 net/core/rtnetlink.c:2946
       do_setlink+0xcf0/0x41c0 net/core/rtnetlink.c:3148
       rtnl_changelink net/core/rtnetlink.c:3759 [inline]
       __rtnl_newlink net/core/rtnetlink.c:3918 [inline]
       rtnl_newlink+0x160b/0x1c70 net/core/rtnetlink.c:4055
       rtnetlink_rcv_msg+0x7cf/0xb70 net/core/rtnetlink.c:6944
       netlink_rcv_skb+0x208/0x470 net/netlink/af_netlink.c:2552
       netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
       netlink_unicast+0x75c/0x8e0 net/netlink/af_netlink.c:1346
       netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
       sock_sendmsg_nosec net/socket.c:712 [inline]
       __sock_sendmsg+0x21c/0x270 net/socket.c:727
       ____sys_sendmsg+0x505/0x830 net/socket.c:2566
       ___sys_sendmsg+0x21f/0x2a0 net/socket.c:2620
       __sys_sendmsg net/socket.c:2652 [inline]
       __do_sys_sendmsg net/socket.c:2657 [inline]
       __se_sys_sendmsg net/socket.c:2655 [inline]
       __x64_sys_sendmsg+0x19b/0x260 net/socket.c:2655
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (team->team_lock_key#2){+.+.}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3168 [inline]
       check_prevs_add kernel/locking/lockdep.c:3287 [inline]
       validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3911
       __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5240
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
       __mutex_lock_common kernel/locking/mutex.c:602 [inline]
       __mutex_lock+0x182/0xe80 kernel/locking/mutex.c:747
       team_port_change_check drivers/net/team/team_core.c:2966 [inline]
       team_device_event+0x544/0xa20 drivers/net/team/team_core.c:2996
       notifier_call_chain+0x1b6/0x3e0 kernel/notifier.c:85
       netif_state_change+0x284/0x3a0 net/core/dev.c:1584
       linkwatch_do_dev+0x117/0x170 net/core/link_watch.c:186
       __linkwatch_run_queue+0x56d/0x7e0 net/core/link_watch.c:244
       linkwatch_event+0x4c/0x60 net/core/link_watch.c:304
       process_one_work kernel/workqueue.c:3238 [inline]
       process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321
       worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402
       kthread+0x711/0x8a0 kernel/kthread.c:464
       ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&dev_instance_lock_key#20);
                               lock(team->team_lock_key#2);
                               lock(&dev_instance_lock_key#20);
  lock(team->team_lock_key#2);

 *** DEADLOCK ***

4 locks held by kworker/u9:3/1377:
 #0: ffff88801a489148 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3213 [inline]
 #0: ffff88801a489148 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_scheduled_works+0x9b4/0x17b0 kernel/workqueue.c:3321
 #1: ffffc90008047bc0 ((linkwatch_work).work){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3214 [inline]
 #1: ffffc90008047bc0 ((linkwatch_work).work){+.+.}-{0:0}, at: process_scheduled_works+0x9ef/0x17b0 kernel/workqueue.c:3321
 #2: ffffffff8f51cdc8 (rtnl_mutex){+.+.}-{4:4}, at: linkwatch_event+0xe/0x60 net/core/link_watch.c:303
 #3: ffff888029958d30 (&dev_instance_lock_key#20){+.+.}-{4:4}, at: netdev_lock include/linux/netdevice.h:2756 [inline]
 #3: ffff888029958d30 (&dev_instance_lock_key#20){+.+.}-{4:4}, at: netdev_lock_ops include/net/netdev_lock.h:42 [inline]
 #3: ffff888029958d30 (&dev_instance_lock_key#20){+.+.}-{4:4}, at: __linkwatch_run_queue+0x4a0/0x7e0 net/core/link_watch.c:243

stack backtrace:
CPU: 0 UID: 0 PID: 1377 Comm: kworker/u9:3 Not tainted 6.16.0-rc6-syzkaller-00411-g95993dc3039e-dirty #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: events_unbound linkwatch_event
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2046
 check_noncircular+0x134/0x160 kernel/locking/lockdep.c:2178
 check_prev_add kernel/locking/lockdep.c:3168 [inline]
 check_prevs_add kernel/locking/lockdep.c:3287 [inline]
 validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3911
 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5240
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871
 __mutex_lock_common kernel/locking/mutex.c:602 [inline]
 __mutex_lock+0x182/0xe80 kernel/locking/mutex.c:747
 team_port_change_check drivers/net/team/team_core.c:2966 [inline]
 team_device_event+0x544/0xa20 drivers/net/team/team_core.c:2996
 notifier_call_chain+0x1b6/0x3e0 kernel/notifier.c:85
 netif_state_change+0x284/0x3a0 net/core/dev.c:1584
 linkwatch_do_dev+0x117/0x170 net/core/link_watch.c:186
 __linkwatch_run_queue+0x56d/0x7e0 net/core/link_watch.c:244
 linkwatch_event+0x4c/0x60 net/core/link_watch.c:304
 process_one_work kernel/workqueue.c:3238 [inline]
 process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321
 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402
 kthread+0x711/0x8a0 kernel/kthread.c:464
 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
wlan0: Created IBSS using preconfigured BSSID 50:50:50:50:50:50
wlan0: Creating new IBSS network, BSSID 50:50:50:50:50:50
wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50
wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50
