batman_adv: batadv0: Interface deactivated: batadv_slave_0
batman_adv: batadv0: Interface deactivated: batadv_slave_1
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.2.565/7674 is trying to acquire lock:
ffff8881a96f28c0 (&port->pnodes_lock){+.+.}-{4:4}, at: ipvlan_device_event+0x468/0xe60

but task is already holding lock:
ffff8881723e0e70 (&dev_instance_lock_key#23){+.+.}-{4:4}, at: do_setlink+0x3d4/0x4670

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&dev_instance_lock_key#23){+.+.}-{4:4}:
       __mutex_lock+0x19d/0x1550
       xsk_bind+0x331/0x1380
       __sys_bind+0x2e3/0x410
       __x64_sys_bind+0x7a/0x90
       do_syscall_64+0x174/0x580
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #2 (&xs->mutex){+.+.}-{4:4}:
       __mutex_lock+0x19d/0x1550
       xsk_notifier+0xcd/0x230
       notifier_call_chain+0x1a5/0x3d0
       unregister_netdevice_many_notify+0x17f9/0x2140
       unregister_netdevice_queue+0x2f5/0x340
       __tun_detach+0xe1a/0x15d0
       tun_chr_close+0x10a/0x1c0
       __fput+0x418/0xa50
       task_work_run+0x1d9/0x270
       exit_to_user_mode_loop+0x1fa/0x730
       do_syscall_64+0x353/0x580
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&net->xdp.lock){+.+.}-{4:4}:
       __mutex_lock+0x19d/0x1550
       xsk_notifier+0x89/0x230
       notifier_call_chain+0x1a5/0x3d0
       unregister_netdevice_many_notify+0x17f9/0x2140
       ipvlan_device_event+0xdd4/0xe60
       notifier_call_chain+0x1a5/0x3d0
       unregister_netdevice_many_notify+0x17f9/0x2140
       rtnl_dellink+0x5be/0x810
       rtnetlink_rcv_msg+0x802/0xc00
       netlink_rcv_skb+0x226/0x4a0
       netlink_unicast+0x7bb/0x940
       netlink_sendmsg+0x813/0xb40
       sock_sendmsg_nosec+0x13a/0x180
       ____sys_sendmsg+0x54e/0x850
       ___sys_sendmsg+0x2a5/0x360
       __x64_sys_sendmsg+0x1b1/0x290
       do_syscall_64+0x174/0x580
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&port->pnodes_lock){+.+.}-{4:4}:
       __lock_acquire+0x1520/0x2cf0
       lock_acquire+0x106/0x350
       __mutex_lock+0x19d/0x1550
       ipvlan_device_event+0x468/0xe60
       notifier_call_chain+0x1a5/0x3d0
       __dev_close_many+0x119/0x6e0
       __dev_change_flags+0x3f5/0x820
       netif_change_flags+0x7c/0x1b0
       do_setlink+0xdd6/0x4670
       rtnl_newlink+0x146f/0x1c30
       rtnetlink_rcv_msg+0x802/0xc00
       netlink_rcv_skb+0x226/0x4a0
       netlink_unicast+0x7bb/0x940
       netlink_sendmsg+0x813/0xb40
       sock_sendmsg_nosec+0x13a/0x180
       ____sys_sendmsg+0x54e/0x850
       ___sys_sendmsg+0x2a5/0x360
       __x64_sys_sendmsg+0x1b1/0x290
       do_syscall_64+0x174/0x580
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  &port->pnodes_lock --> &xs->mutex --> &dev_instance_lock_key#23

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&dev_instance_lock_key#23);
                               lock(&xs->mutex);
                               lock(&dev_instance_lock_key#23);
  lock(&port->pnodes_lock);

 *** DEADLOCK ***

2 locks held by syz.2.565/7674:
 #0: ffffffff90027ac0 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_newlink+0xc10/0x1c30
 #1: ffff8881723e0e70 (&dev_instance_lock_key#23){+.+.}-{4:4}, at: do_setlink+0x3d4/0x4670

stack backtrace:
CPU: 1 UID: 0 PID: 7674 Comm: syz.2.565 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150
 print_circular_bug+0x2e1/0x300
 check_noncircular+0x12e/0x150
 __lock_acquire+0x1520/0x2cf0
 lock_acquire+0x106/0x350
 __mutex_lock+0x19d/0x1550
 ipvlan_device_event+0x468/0xe60
 notifier_call_chain+0x1a5/0x3d0
 __dev_close_many+0x119/0x6e0
 __dev_change_flags+0x3f5/0x820
 netif_change_flags+0x7c/0x1b0
 do_setlink+0xdd6/0x4670
 rtnl_newlink+0x146f/0x1c30
 rtnetlink_rcv_msg+0x802/0xc00
 netlink_rcv_skb+0x226/0x4a0
 netlink_unicast+0x7bb/0x940
 netlink_sendmsg+0x813/0xb40
 sock_sendmsg_nosec+0x13a/0x180
 ____sys_sendmsg+0x54e/0x850
 ___sys_sendmsg+0x2a5/0x360
 __x64_sys_sendmsg+0x1b1/0x290
 do_syscall_64+0x174/0x580
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f34cef9e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f34cfe1e028 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f34cf226090 RCX: 00007f34cef9e0d9
RDX: 0000000020040090 RSI: 0000200000000140 RDI: 0000000000000005
RBP: 00007f34cf035024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f34cf226128 R14: 00007f34cf226090 R15: 00007ffe1a0ad3c8
 </TASK>
ipvlan2: left allmulticast mode
netdevsim netdevsim2 netdevsim0: left allmulticast mode
bond1: left promiscuous mode
ipvlan3: left allmulticast mode
ipvlan4: left allmulticast mode
bond1: left allmulticast mode
bond2: left promiscuous mode
bridge1: left promiscuous mode
bond3: left promiscuous mode
ipvlan5: left allmulticast mode
ipvlan6: left allmulticast mode
bond3: left allmulticast mode
bond4: left promiscuous mode
bond6: left promiscuous mode
bridge3: left promiscuous mode
bond7: left promiscuous mode
bridge4: left promiscuous mode
ipvlan7: left allmulticast mode
bond7: left allmulticast mode
bridge4: left allmulticast mode
bond8: left promiscuous mode
bridge5: left promiscuous mode
ipvlan8: left allmulticast mode
ipvlan9: left allmulticast mode
bond8: left allmulticast mode
bridge5: left allmulticast mode
gretap1: left promiscuous mode
