BUG: sleeping function called from invalid context at include/linux/sched/mm.h:274 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 3972, name: syz-executor.0 preempt_count: 201, expected: 0 RCU nest depth: 0, expected: 0 2 locks held by syz-executor.0/3972: #0: ffffffff8e0949a8 (rtnl_mutex){+.+.}-{3:3}, at: rtnl_lock net/core/rtnetlink.c:74 [inline] #0: ffffffff8e0949a8 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x720/0xf00 net/core/rtnetlink.c:6094 #1: ffff88807bbed908 (&sch->q.lock){+...}-{2:2}, at: netem_change+0x17e/0x1ea0 net/sched/sch_netem.c:969 Preemption disabled at: [<0000000000000000>] 0x0 CPU: 0 PID: 3972 Comm: syz-executor.0 Not tainted 6.1.37-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 __might_resched+0x5cb/0x780 kernel/sched/core.c:9941 might_alloc include/linux/sched/mm.h:274 [inline] slab_pre_alloc_hook+0x4a/0x2a0 mm/slab.h:710 slab_alloc_node mm/slub.c:3318 [inline] __kmem_cache_alloc_node+0x47/0x260 mm/slub.c:3437 __do_kmalloc_node mm/slab_common.c:954 [inline] __kmalloc_node+0xa2/0x230 mm/slab_common.c:962 kmalloc_node include/linux/slab.h:579 [inline] kvmalloc_node+0x6e/0x180 mm/util.c:581 kvmalloc include/linux/slab.h:706 [inline] get_dist_table+0x91/0x380 net/sched/sch_netem.c:788 netem_change+0x947/0x1ea0 net/sched/sch_netem.c:985 netem_init+0x58/0xb0 net/sched/sch_netem.c:1072 qdisc_create+0x8a1/0x1220 net/sched/sch_api.c:1314 tc_modify_qdisc+0x9e0/0x1da0 net/sched/sch_api.c:1723 rtnetlink_rcv_msg+0x776/0xf00 net/core/rtnetlink.c:6097 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2524 netlink_unicast_kernel net/netlink/af_netlink.c:1328 [inline] netlink_unicast+0x7bf/0x990 net/netlink/af_netlink.c:1354 netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1902 sock_sendmsg_nosec net/socket.c:716 [inline] sock_sendmsg net/socket.c:736 [inline] ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2482 ___sys_sendmsg net/socket.c:2536 [inline] __sys_sendmsg+0x2a9/0x390 net/socket.c:2565 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f1d0a08c389 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f1d0ae82168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f1d0a1abf80 RCX: 00007f1d0a08c389 RDX: 0000000000000000 RSI: 00000000200007c0 RDI: 0000000000000003 RBP: 00007f1d0a0d7493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe44408cdf R14: 00007f1d0ae82300 R15: 0000000000022000 ============================================ WARNING: possible recursive locking detected 6.1.37-syzkaller #0 Tainted: G W -------------------------------------------- syz-executor.0/3972 is trying to acquire lock: ffff88807bbed908 (&sch->q.lock){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:355 [inline] ffff88807bbed908 (&sch->q.lock){+...}-{2:2}, at: get_dist_table+0x254/0x380 net/sched/sch_netem.c:798 but task is already holding lock: ffff88807bbed908 (&sch->q.lock){+...}-{2:2}, at: netem_change+0x17e/0x1ea0 net/sched/sch_netem.c:969 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&sch->q.lock); lock(&sch->q.lock); *** DEADLOCK *** May be due to missing lock nesting notation 2 locks held by syz-executor.0/3972: #0: ffffffff8e0949a8 (rtnl_mutex){+.+.}-{3:3}, at: rtnl_lock net/core/rtnetlink.c:74 [inline] #0: ffffffff8e0949a8 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x720/0xf00 net/core/rtnetlink.c:6094 #1: ffff88807bbed908 (&sch->q.lock){+...}-{2:2}, at: netem_change+0x17e/0x1ea0 net/sched/sch_netem.c:969 stack backtrace: CPU: 0 PID: 3972 Comm: syz-executor.0 Tainted: G W 6.1.37-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_deadlock_bug kernel/locking/lockdep.c:2991 [inline] check_deadlock kernel/locking/lockdep.c:3034 [inline] validate_chain+0x4726/0x58e0 kernel/locking/lockdep.c:3819 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:355 [inline] get_dist_table+0x254/0x380 net/sched/sch_netem.c:798 netem_change+0x947/0x1ea0 net/sched/sch_netem.c:985 netem_init+0x58/0xb0 net/sched/sch_netem.c:1072 qdisc_create+0x8a1/0x1220 net/sched/sch_api.c:1314 tc_modify_qdisc+0x9e0/0x1da0 net/sched/sch_api.c:1723 rtnetlink_rcv_msg+0x776/0xf00 net/core/rtnetlink.c:6097 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2524 netlink_unicast_kernel net/netlink/af_netlink.c:1328 [inline] netlink_unicast+0x7bf/0x990 net/netlink/af_netlink.c:1354 netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1902 sock_sendmsg_nosec net/socket.c:716 [inline] sock_sendmsg net/socket.c:736 [inline] ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2482 ___sys_sendmsg net/socket.c:2536 [inline] __sys_sendmsg+0x2a9/0x390 net/socket.c:2565 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f1d0a08c389 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f1d0ae82168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f1d0a1abf80 RCX: 00007f1d0a08c389 RDX: 0000000000000000 RSI: 00000000200007c0 RDI: 0000000000000003 RBP: 00007f1d0a0d7493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe44408cdf R14: 00007f1d0ae82300 R15: 0000000000022000