======================================================
WARNING: possible circular locking dependency detected
5.2.0+ #35 Not tainted
------------------------------------------------------
syz-executor.5/11259 is trying to acquire lock:
00000000e620338b (rtnl_mutex){+.+.}, at: rtnl_lock+0x17/0x20 /net/core/rtnetlink.c:72

but task is already holding lock:
00000000dcb4447d (&xs->mutex){+.+.}, at: xsk_bind+0x16e/0xca0 /net/xdp/xsk.c:436

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&xs->mutex){+.+.}:
       __mutex_lock_common+0x17c/0x2850 /kernel/locking/mutex.c:926
       __mutex_lock /kernel/locking/mutex.c:1073 [inline]
       mutex_lock_nested+0x1b/0x30 /kernel/locking/mutex.c:1088
       xsk_notifier+0xe7/0x3b0 /net/xdp/xsk.c:764
       notifier_call_chain /kernel/notifier.c:95 [inline]
       __raw_notifier_call_chain /kernel/notifier.c:396 [inline]
       raw_notifier_call_chain+0xec/0x190 /kernel/notifier.c:403
       call_netdevice_notifiers_info /net/core/dev.c:1749 [inline]
       call_netdevice_notifiers_extack /net/core/dev.c:1761 [inline]
       call_netdevice_notifiers /net/core/dev.c:1775 [inline]
       rollback_registered_many+0xd46/0x1410 /net/core/dev.c:8196
       rollback_registered /net/core/dev.c:8238 [inline]
       unregister_netdevice_queue+0x333/0x500 /net/core/dev.c:9285
       unregister_netdevice /./include/linux/netdevice.h:2631 [inline]
       __tun_detach+0x1101/0x1a90 /drivers/net/tun.c:723
       tun_detach /drivers/net/tun.c:740 [inline]
       tun_chr_close+0xf1/0x130 /drivers/net/tun.c:3439
       __fput+0x2e4/0x740 /fs/file_table.c:280
       ____fput+0x15/0x20 /fs/file_table.c:313
       task_work_run+0x17e/0x1b0 /kernel/task_work.c:113
       tracehook_notify_resume /./include/linux/tracehook.h:188 [inline]
       exit_to_usermode_loop /arch/x86/entry/common.c:163 [inline]
       prepare_exit_to_usermode+0x459/0x580 /arch/x86/entry/common.c:194
       syscall_return_slowpath+0x113/0x4a0 /arch/x86/entry/common.c:274
       do_syscall_64+0x126/0x140 /arch/x86/entry/common.c:299
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #1 (&net->xdp.lock){+.+.}:
       __mutex_lock_common+0x17c/0x2850 /kernel/locking/mutex.c:926
       __mutex_lock /kernel/locking/mutex.c:1073 [inline]
       mutex_lock_nested+0x1b/0x30 /kernel/locking/mutex.c:1088
       xsk_notifier+0x8c/0x3b0 /net/xdp/xsk.c:760
       notifier_call_chain /kernel/notifier.c:95 [inline]
       __raw_notifier_call_chain /kernel/notifier.c:396 [inline]
       raw_notifier_call_chain+0xec/0x190 /kernel/notifier.c:403
       call_netdevice_notifiers_info /net/core/dev.c:1749 [inline]
       call_netdevice_notifiers_extack /net/core/dev.c:1761 [inline]
       call_netdevice_notifiers /net/core/dev.c:1775 [inline]
       rollback_registered_many+0xd46/0x1410 /net/core/dev.c:8196
       rollback_registered /net/core/dev.c:8238 [inline]
       unregister_netdevice_queue+0x333/0x500 /net/core/dev.c:9285
       unregister_netdevice /./include/linux/netdevice.h:2631 [inline]
       __tun_detach+0x1101/0x1a90 /drivers/net/tun.c:723
       tun_detach /drivers/net/tun.c:740 [inline]
       tun_chr_close+0xf1/0x130 /drivers/net/tun.c:3439
       __fput+0x2e4/0x740 /fs/file_table.c:280
       ____fput+0x15/0x20 /fs/file_table.c:313
       task_work_run+0x17e/0x1b0 /kernel/task_work.c:113
       exit_task_work /./include/linux/task_work.h:22 [inline]
       do_exit+0x64c/0x2310 /kernel/exit.c:877
       do_group_exit+0x15c/0x2b0 /kernel/exit.c:981
       __do_sys_exit_group+0x17/0x20 /kernel/exit.c:992
       __se_sys_exit_group+0x14/0x20 /kernel/exit.c:990
       __x64_sys_exit_group+0x3b/0x40 /kernel/exit.c:990
       do_syscall_64+0xfe/0x140 /arch/x86/entry/common.c:296
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (rtnl_mutex){+.+.}:
       validate_chain /kernel/locking/lockdep.c:2897 [inline]
       __lock_acquire+0x2531/0x4750 /kernel/locking/lockdep.c:3880
       lock_acquire+0x158/0x250 /kernel/locking/lockdep.c:4413
       __mutex_lock_common+0x17c/0x2850 /kernel/locking/mutex.c:926
       __mutex_lock /kernel/locking/mutex.c:1073 [inline]
       mutex_lock_nested+0x1b/0x30 /kernel/locking/mutex.c:1088
       rtnl_lock+0x17/0x20 /net/core/rtnetlink.c:72
       xdp_umem_assign_dev+0xce/0x850 /net/xdp/xdp_umem.c:96
       xsk_bind+0x4ab/0xca0 /net/xdp/xsk.c:502
       __sys_bind+0x305/0x400 /net/socket.c:1643
       __do_sys_bind /net/socket.c:1654 [inline]
       __se_sys_bind /net/socket.c:1652 [inline]
       __x64_sys_bind+0x7a/0x90 /net/socket.c:1652
       do_syscall_64+0xfe/0x140 /arch/x86/entry/common.c:296
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

Chain exists of:
  rtnl_mutex --> &net->xdp.lock --> &xs->mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&xs->mutex);
                               lock(&net->xdp.lock);
                               lock(&xs->mutex);
  lock(rtnl_mutex);

 *** DEADLOCK ***

1 lock held by syz-executor.5/11259:
 #0: 00000000dcb4447d (&xs->mutex){+.+.}, at: xsk_bind+0x16e/0xca0 /net/xdp/xsk.c:436

stack backtrace:
CPU: 1 PID: 11259 Comm: syz-executor.5 Not tainted 5.2.0+ #35
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack /lib/dump_stack.c:77 [inline]
 dump_stack+0x1d8/0x2f8 /lib/dump_stack.c:113
 print_circular_bug+0xd64/0xf50 /kernel/locking/lockdep.c:1616
 check_noncircular+0x30d/0x560 /kernel/locking/lockdep.c:1741
 check_prev_add /kernel/locking/lockdep.c:2405 [inline]
 check_prevs_add+0x560/0x5950 /kernel/locking/lockdep.c:2507
 validate_chain /kernel/locking/lockdep.c:2897 [inline]
 __lock_acquire+0x2531/0x4750 /kernel/locking/lockdep.c:3880
 lock_acquire+0x158/0x250 /kernel/locking/lockdep.c:4413
 __mutex_lock_common+0x17c/0x2850 /kernel/locking/mutex.c:926
 __mutex_lock /kernel/locking/mutex.c:1073 [inline]
 mutex_lock_nested+0x1b/0x30 /kernel/locking/mutex.c:1088
 rtnl_lock+0x17/0x20 /net/core/rtnetlink.c:72
 xdp_umem_assign_dev+0xce/0x850 /net/xdp/xdp_umem.c:96
 xsk_bind+0x4ab/0xca0 /net/xdp/xsk.c:502
 __sys_bind+0x305/0x400 /net/socket.c:1643
 __do_sys_bind /net/socket.c:1654 [inline]
 __se_sys_bind /net/socket.c:1652 [inline]
 __x64_sys_bind+0x7a/0x90 /net/socket.c:1652
 do_syscall_64+0xfe/0x140 /arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459819
Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fa256854c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000031
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000459819
RDX: 0000000000000010 RSI: 0000000020000300 RDI: 0000000000000004
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fa2568556d4
R13: 00000000004bfa6d R14: 00000000004d1450 R15: 00000000ffffffff