BUG: sleeping function called from invalid context at include/linux/sched/mm.h:209
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 3486, name: syz-executor214
2 locks held by syz-executor214/3486:
#0: ffffffff8d9e1148 (rtnl_mutex){+.+.}-{3:3}, at: rtnl_lock net/core/rtnetlink.c:72 [inline]
#0: ffffffff8d9e1148 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x94c/0xee0 net/core/rtnetlink.c:5600
#1: ffff88801cb10908 (&sch->q.lock){+...}-{2:2}, at: netem_change+0x257/0x20c0 net/sched/sch_netem.c:972
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 0 PID: 3486 Comm: syz-executor214 Not tainted 5.15.126-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
___might_sleep+0x547/0x6a0 kernel/sched/core.c:9625
might_alloc include/linux/sched/mm.h:209 [inline]
slab_pre_alloc_hook+0x44/0xc0 mm/slab.h:492
slab_alloc_node mm/slub.c:3134 [inline]
__kmalloc_node+0x71/0x390 mm/slub.c:4451
kmalloc_node include/linux/slab.h:614 [inline]
kvmalloc_node+0x80/0x140 mm/util.c:619
kvmalloc include/linux/mm.h:805 [inline]
get_dist_table+0x83/0x2c0 net/sched/sch_netem.c:788
netem_change+0xa05/0x20c0 net/sched/sch_netem.c:988
netem_init+0x58/0xb0 net/sched/sch_netem.c:1075
qdisc_create+0x8ae/0x1390 net/sched/sch_api.c:1264
tc_modify_qdisc+0xac5/0x1710
rtnetlink_rcv_msg+0x993/0xee0 net/core/rtnetlink.c:5603
netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505
netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356
netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1924
sock_sendmsg_nosec net/socket.c:704 [inline]
sock_sendmsg net/socket.c:724 [inline]
____sys_sendmsg+0x59e/0x8f0 net/socket.c:2412
___sys_sendmsg+0x252/0x2e0 net/socket.c:2466
__sys_sendmsg net/socket.c:2495 [inline]
__do_sys_sendmsg net/socket.c:2504 [inline]
__se_sys_sendmsg+0x19a/0x260 net/socket.c:2502
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+0x61/0xcb
RIP: 0033:0x7fb4240135a9
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 00 00 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffe733a5d8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fffe733a7a8 RCX: 00007fb4240135a9
RDX: 0000000000000000 RSI: 0000000020000040 RDI: 0000000000000003
RBP: 00007fb424086610 R08: 000000000000000a R09: 00007fffe733a7a8
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000001
R13: 00007fffe733a798 R14: 0000000000000001 R15: 0000000000000001
============================================
WARNING: possible recursive locking detected
5.15.126-syzkaller #0 Tainted: G W
--------------------------------------------
syz-executor214/3486 is trying to acquire lock:
ffff88801cb10908 (&sch->q.lock){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:368 [inline]
ffff88801cb10908 (&sch->q.lock){+...}-{2:2}, at: get_dist_table+0x1fa/0x2c0 net/sched/sch_netem.c:798
but task is already holding lock:
ffff88801cb10908 (&sch->q.lock){+...}-{2:2}, at: netem_change+0x257/0x20c0 net/sched/sch_netem.c:972
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-executor214/3486:
#0: ffffffff8d9e1148 (rtnl_mutex){+.+.}-{3:3}, at: rtnl_lock net/core/rtnetlink.c:72 [inline]
#0: ffffffff8d9e1148 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x94c/0xee0 net/core/rtnetlink.c:5600
#1: ffff88801cb10908 (&sch->q.lock){+...}-{2:2}, at: netem_change+0x257/0x20c0 net/sched/sch_netem.c:972
stack backtrace:
CPU: 0 PID: 3486 Comm: syz-executor214 Tainted: G W 5.15.126-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/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:2946 [inline]
check_deadlock kernel/locking/lockdep.c:2989 [inline]
validate_chain+0x46cf/0x58b0 kernel/locking/lockdep.c:3774
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
_raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:178
spin_lock_bh include/linux/spinlock.h:368 [inline]
get_dist_table+0x1fa/0x2c0 net/sched/sch_netem.c:798
netem_change+0xa05/0x20c0 net/sched/sch_netem.c:988
netem_init+0x58/0xb0 net/sched/sch_netem.c:1075
qdisc_create+0x8ae/0x1390 net/sched/sch_api.c:1264
tc_modify_qdisc+0xac5/0x1710
rtnetlink_rcv_msg+0x993/0xee0 net/core/rtnetlink.c:5603
netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505
netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356
netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1924
sock_sendmsg_nosec net/socket.c:704 [inline]
sock_sendmsg net/socket.c:724 [inline]
____sys_sendmsg+0x59e/0x8f0 net/socket.c:2412
___sys_sendmsg+0x252/0x2e0 net/socket.c:2466
__sys_sendmsg net/socket.c:2495 [inline]
__do_sys_sendmsg net/socket.c:2504 [inline]
__se_sys_sendmsg+0x19a/0x260 net/socket.c:2502
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+0x61/0xcb
RIP: 0033:0x7fb4240135a9
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 00 00 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffe733a5d8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fffe733a7a8 RCX: 00007fb4240135a9
RDX: 0000000000000000 RSI: 0000000020000040 RDI: 0000000000000003
RBP: 00007fb424086610 R08: 000000000000000a R09: 00007fffe733a7a8
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000001
R13: 00007fffe733a798 R14: 0000000000000001 R15: 0000000000000001