======================================================
WARNING: possible circular locking dependency detected
5.12.0-rc7-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/25730 is trying to acquire lock:
ffff888012405c60 (&net->sctp.addr_wq_lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:359 [inline]
ffff888012405c60 (&net->sctp.addr_wq_lock){+.-.}-{2:2}, at: sctp_destroy_sock+0x204/0x440 net/sctp/socket.c:5028

but task is already holding lock:
ffff88801abdf7a0 (slock-AF_INET6){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:354 [inline]
ffff88801abdf7a0 (slock-AF_INET6){+.-.}-{2:2}, at: sctp_close+0x473/0x940 net/sctp/socket.c:1525

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (slock-AF_INET6){+.-.}-{2:2}:
       __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
       _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151
       spin_lock include/linux/spinlock.h:354 [inline]
       sctp_addr_wq_timeout_handler+0x1a1/0x550 net/sctp/protocol.c:666
       call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1431
       expire_timers kernel/time/timer.c:1476 [inline]
       __run_timers.part.0+0x67c/0xa50 kernel/time/timer.c:1745
       __run_timers kernel/time/timer.c:1726 [inline]
       run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1758
       __do_softirq+0x29b/0x9f6 kernel/softirq.c:345
       invoke_softirq kernel/softirq.c:221 [inline]
       __irq_exit_rcu kernel/softirq.c:422 [inline]
       irq_exit_rcu+0x134/0x200 kernel/softirq.c:434
       sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1100
       asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:632
       __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:161 [inline]
       _raw_spin_unlock_irqrestore+0x38/0x70 kernel/locking/spinlock.c:191
       hrtimer_start_expires include/linux/hrtimer.h:436 [inline]
       hrtimer_sleeper_start_expires kernel/time/hrtimer.c:1817 [inline]
       do_nanosleep+0x202/0x6a0 kernel/time/hrtimer.c:1893
       hrtimer_nanosleep+0x1f9/0x4a0 kernel/time/hrtimer.c:1949
       common_nsleep+0xa2/0xc0 kernel/time/posix-timers.c:1227
       __do_sys_clock_nanosleep kernel/time/posix-timers.c:1267 [inline]
       __se_sys_clock_nanosleep kernel/time/posix-timers.c:1245 [inline]
       __x64_sys_clock_nanosleep+0x2f4/0x430 kernel/time/posix-timers.c:1245
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xae

-> #0 (&net->sctp.addr_wq_lock){+.-.}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:2937 [inline]
       check_prevs_add kernel/locking/lockdep.c:3060 [inline]
       validate_chain kernel/locking/lockdep.c:3675 [inline]
       __lock_acquire+0x2b14/0x54c0 kernel/locking/lockdep.c:4901
       lock_acquire kernel/locking/lockdep.c:5511 [inline]
       lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5476
       __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
       _raw_spin_lock_bh+0x2f/0x40 kernel/locking/spinlock.c:175
       spin_lock_bh include/linux/spinlock.h:359 [inline]
       sctp_destroy_sock+0x204/0x440 net/sctp/socket.c:5028
       sctp_v6_destroy_sock+0x11/0x20 net/sctp/socket.c:9528
       sk_common_release+0x64/0x390 net/core/sock.c:3264
       sctp_close+0x4da/0x940 net/sctp/socket.c:1531
       inet_release+0x12e/0x280 net/ipv4/af_inet.c:431
       inet6_release+0x4c/0x70 net/ipv6/af_inet6.c:478
       __sock_release+0xcd/0x280 net/socket.c:599
       sock_close+0x18/0x20 net/socket.c:1258
       __fput+0x288/0x920 fs/file_table.c:280
       task_work_run+0xdd/0x1a0 kernel/task_work.c:140
       tracehook_notify_resume include/linux/tracehook.h:189 [inline]
       exit_to_user_mode_loop kernel/entry/common.c:174 [inline]
       exit_to_user_mode_prepare+0x249/0x250 kernel/entry/common.c:208
       __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
       syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:301
       entry_SYSCALL_64_after_hwframe+0x44/0xae

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(slock-AF_INET6);
                               lock(&net->sctp.addr_wq_lock);
                               lock(slock-AF_INET6);
  lock(&net->sctp.addr_wq_lock);

 *** DEADLOCK ***

2 locks held by syz-executor.3/25730:
 #0: ffff88806c75f150 (&sb->s_type->i_mutex_key#13){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:775 [inline]
 #0: ffff88806c75f150 (&sb->s_type->i_mutex_key#13){+.+.}-{3:3}, at: __sock_release+0x86/0x280 net/socket.c:598
 #1: ffff88801abdf7a0 (slock-AF_INET6){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:354 [inline]
 #1: ffff88801abdf7a0 (slock-AF_INET6){+.-.}-{2:2}, at: sctp_close+0x473/0x940 net/sctp/socket.c:1525

stack backtrace:
CPU: 0 PID: 25730 Comm: syz-executor.3 Not tainted 5.12.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x141/0x1d7 lib/dump_stack.c:120
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2128
 check_prev_add kernel/locking/lockdep.c:2937 [inline]
 check_prevs_add kernel/locking/lockdep.c:3060 [inline]
 validate_chain kernel/locking/lockdep.c:3675 [inline]
 __lock_acquire+0x2b14/0x54c0 kernel/locking/lockdep.c:4901
 lock_acquire kernel/locking/lockdep.c:5511 [inline]
 lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5476
 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
 _raw_spin_lock_bh+0x2f/0x40 kernel/locking/spinlock.c:175
 spin_lock_bh include/linux/spinlock.h:359 [inline]
 sctp_destroy_sock+0x204/0x440 net/sctp/socket.c:5028
 sctp_v6_destroy_sock+0x11/0x20 net/sctp/socket.c:9528
 sk_common_release+0x64/0x390 net/core/sock.c:3264
 sctp_close+0x4da/0x940 net/sctp/socket.c:1531
 inet_release+0x12e/0x280 net/ipv4/af_inet.c:431
 inet6_release+0x4c/0x70 net/ipv6/af_inet6.c:478
 __sock_release+0xcd/0x280 net/socket.c:599
 sock_close+0x18/0x20 net/socket.c:1258
 __fput+0x288/0x920 fs/file_table.c:280
 task_work_run+0xdd/0x1a0 kernel/task_work.c:140
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:174 [inline]
 exit_to_user_mode_prepare+0x249/0x250 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x41940b
Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44
RSP: 002b:00007ffe07f81460 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000007 RCX: 000000000041940b
RDX: 000000008e6e81dd RSI: 000000000c151b1f RDI: 0000000000000006
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000001b3292b58c
R10: 000000000001cfe6 R11: 0000000000000293 R12: 000000000056c9e0
R13: 000000000056c9e0 R14: 000000000056bf60 R15: 0000000000092a92