batman_adv: batadv0: Interface activated: batadv_slave_1
IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
======================================================
WARNING: possible circular locking dependency detected
4.14.172-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.0/8680 is trying to acquire lock:
 ((&strp->work)){+.+.}, at: [<ffffffff813ae1d2>] flush_work+0x82/0x780 kernel/workqueue.c:2884

but task is already holding lock:
 (sk_lock-AF_INET){+.+.}, at: [<ffffffff85bdeb28>] lock_sock include/net/sock.h:1467 [inline]
 (sk_lock-AF_INET){+.+.}, at: [<ffffffff85bdeb28>] kcm_attach net/kcm/kcmsock.c:1390 [inline]
 (sk_lock-AF_INET){+.+.}, at: [<ffffffff85bdeb28>] kcm_attach_ioctl net/kcm/kcmsock.c:1490 [inline]
 (sk_lock-AF_INET){+.+.}, at: [<ffffffff85bdeb28>] kcm_ioctl+0x328/0x1010 net/kcm/kcmsock.c:1701

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (sk_lock-AF_INET){+.+.}:
       lock_sock_nested+0xb7/0x100 net/core/sock.c:2770
       do_strp_work net/strparser/strparser.c:415 [inline]
       strp_work+0x3e/0x100 net/strparser/strparser.c:434
       process_one_work+0x813/0x1540 kernel/workqueue.c:2114
       worker_thread+0x5d1/0x1070 kernel/workqueue.c:2248
       kthread+0x30d/0x420 kernel/kthread.c:232
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

-> #0 ((&strp->work)){+.+.}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3994
       flush_work+0xae/0x780 kernel/workqueue.c:2887
       __cancel_work_timer+0x2d0/0x460 kernel/workqueue.c:2962
       strp_done+0x53/0xd0 net/strparser/strparser.c:519
       kcm_attach net/kcm/kcmsock.c:1429 [inline]
       kcm_attach_ioctl net/kcm/kcmsock.c:1490 [inline]
       kcm_ioctl+0x856/0x1010 net/kcm/kcmsock.c:1701
       sock_do_ioctl+0x5f/0xa0 net/socket.c:974
       sock_ioctl+0x28d/0x450 net/socket.c:1071
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:500 [inline]
       do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684
       SYSC_ioctl fs/ioctl.c:701 [inline]
       SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x42/0xb7

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sk_lock-AF_INET);
                               lock((&strp->work));
                               lock(sk_lock-AF_INET);
  lock((&strp->work));

 *** DEADLOCK ***

1 lock held by syz-executor.0/8680:
 #0:  (sk_lock-AF_INET){+.+.}, at: [<ffffffff85bdeb28>] lock_sock include/net/sock.h:1467 [inline]
 #0:  (sk_lock-AF_INET){+.+.}, at: [<ffffffff85bdeb28>] kcm_attach net/kcm/kcmsock.c:1390 [inline]
 #0:  (sk_lock-AF_INET){+.+.}, at: [<ffffffff85bdeb28>] kcm_attach_ioctl net/kcm/kcmsock.c:1490 [inline]
 #0:  (sk_lock-AF_INET){+.+.}, at: [<ffffffff85bdeb28>] kcm_ioctl+0x328/0x1010 net/kcm/kcmsock.c:1701

stack backtrace:
CPU: 1 PID: 8680 Comm: syz-executor.0 Not tainted 4.14.172-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x13e/0x194 lib/dump_stack.c:58
 print_circular_bug.isra.0.cold+0x1c4/0x282 kernel/locking/lockdep.c:1258
 check_prev_add kernel/locking/lockdep.c:1901 [inline]
 check_prevs_add kernel/locking/lockdep.c:2018 [inline]
 validate_chain kernel/locking/lockdep.c:2460 [inline]
 __lock_acquire+0x2cb3/0x4620 kernel/locking/lockdep.c:3487
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3994
 flush_work+0xae/0x780 kernel/workqueue.c:2887
 __cancel_work_timer+0x2d0/0x460 kernel/workqueue.c:2962
 strp_done+0x53/0xd0 net/strparser/strparser.c:519
 kcm_attach net/kcm/kcmsock.c:1429 [inline]
 kcm_attach_ioctl net/kcm/kcmsock.c:1490 [inline]
 kcm_ioctl+0x856/0x1010 net/kcm/kcmsock.c:1701
 sock_do_ioctl+0x5f/0xa0 net/socket.c:974
 sock_ioctl+0x28d/0x450 net/socket.c:1071
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45c4a9
RSP: 002b:00007f24203c7c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f24203c86d4 RCX: 000000000045c4a9
RDX: 0000000020000380 RSI: 00000000000089e0 RDI: 0000000000000004
RBP: 000000000076bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000006d8 R14: 00000000004c9641 R15: 000000000076bf2c