BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1479 in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 3590, name: syz-executor672 1 lock held by syz-executor672/3590: #0: ffffffff8c941f98 (css_set_lock){....}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:388 [inline] #0: ffffffff8c941f98 (css_set_lock){....}-{2:2}, at: cgroup_get_from_path+0x24/0x290 kernel/cgroup/cgroup.c:6603 irq event stamp: 15138 hardirqs last enabled at (15137): [] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] hardirqs last enabled at (15137): [] _raw_spin_unlock_irqrestore+0x8b/0x130 kernel/locking/spinlock.c:194 hardirqs last disabled at (15138): [] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:126 [inline] hardirqs last disabled at (15138): [] _raw_spin_lock_irq+0xa9/0x110 kernel/locking/spinlock.c:170 softirqs last enabled at (15124): [] do_ipv6_setsockopt net/ipv6/ipv6_sockglue.c:986 [inline] softirqs last enabled at (15124): [] ipv6_setsockopt+0x2ee1/0x43c0 net/ipv6/ipv6_sockglue.c:1010 softirqs last disabled at (15122): [] spin_lock_bh include/linux/spinlock.h:368 [inline] softirqs last disabled at (15122): [] release_sock+0x2c/0x1c0 net/core/sock.c:3220 Preemption disabled at: [<0000000000000000>] 0x0 CPU: 1 PID: 3590 Comm: syz-executor672 Not tainted 5.15.98-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 ___might_sleep+0x535/0x690 kernel/sched/core.c:9622 down_read+0x17/0x50 kernel/locking/rwsem.c:1479 kernfs_walk_and_get_ns+0x7e/0x2b0 fs/kernfs/dir.c:894 kernfs_walk_and_get include/linux/kernfs.h:559 [inline] cgroup_get_from_path+0x5c/0x290 kernel/cgroup/cgroup.c:6605 cgroup_mt_check_v1+0x1a0/0x2b0 net/netfilter/xt_cgroup.c:56 xt_check_match+0x363/0xa30 net/netfilter/x_tables.c:523 check_match net/ipv6/netfilter/ip6_tables.c:490 [inline] find_check_match net/ipv6/netfilter/ip6_tables.c:507 [inline] find_check_entry net/ipv6/netfilter/ip6_tables.c:558 [inline] translate_table+0x1669/0x2320 net/ipv6/netfilter/ip6_tables.c:735 do_replace net/ipv6/netfilter/ip6_tables.c:1153 [inline] do_ip6t_set_ctl+0x2cf3/0x3f50 net/ipv6/netfilter/ip6_tables.c:1639 nf_setsockopt+0x28a/0x2b0 net/netfilter/nf_sockopt.c:101 ipv6_setsockopt+0x2f5c/0x43c0 net/ipv6/ipv6_sockglue.c:1015 __sys_setsockopt+0x57e/0x990 net/socket.c:2179 __do_sys_setsockopt net/socket.c:2190 [inline] __se_sys_setsockopt net/socket.c:2187 [inline] __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2187 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:0x7f596e554fd9 Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 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 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffd7eef1128 EFLAGS: 00000246 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f596e554fd9 RDX: 0000000000000040 RSI: 0000000000000029 RDI: 0000000000000003 RBP: 00007f596e518fc0 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000020002680 R11: 0000000000000246 R12: 00007f596e519050 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 ============================= [ BUG: Invalid wait context ] 5.15.98-syzkaller #0 Tainted: G W ----------------------------- syz-executor672/3590 is trying to lock: ffffffff8ca4dfd0 (kernfs_rwsem){++++}-{3:3}, at: kernfs_walk_and_get_ns+0x7e/0x2b0 fs/kernfs/dir.c:894 other info that might help us debug this: context-{4:4} 1 lock held by syz-executor672/3590: #0: ffffffff8c941f98 (css_set_lock){....}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:388 [inline] #0: ffffffff8c941f98 (css_set_lock){....}-{2:2}, at: cgroup_get_from_path+0x24/0x290 kernel/cgroup/cgroup.c:6603 stack backtrace: CPU: 1 PID: 3590 Comm: syz-executor672 Tainted: G W 5.15.98-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_lock_invalid_wait_context kernel/locking/lockdep.c:4663 [inline] check_wait_context kernel/locking/lockdep.c:4724 [inline] __lock_acquire+0x14f5/0x1ff0 kernel/locking/lockdep.c:4961 lock_acquire+0x1f6/0x560 kernel/locking/lockdep.c:5622 down_read+0x3b/0x50 kernel/locking/rwsem.c:1480 kernfs_walk_and_get_ns+0x7e/0x2b0 fs/kernfs/dir.c:894 kernfs_walk_and_get include/linux/kernfs.h:559 [inline] cgroup_get_from_path+0x5c/0x290 kernel/cgroup/cgroup.c:6605 cgroup_mt_check_v1+0x1a0/0x2b0 net/netfilter/xt_cgroup.c:56 xt_check_match+0x363/0xa30 net/netfilter/x_tables.c:523 check_match net/ipv6/netfilter/ip6_tables.c:490 [inline] find_check_match net/ipv6/netfilter/ip6_tables.c:507 [inline] find_check_entry net/ipv6/netfilter/ip6_tables.c:558 [inline] translate_table+0x1669/0x2320 net/ipv6/netfilter/ip6_tables.c:735 do_replace net/ipv6/netfilter/ip6_tables.c:1153 [inline] do_ip6t_set_ctl+0x2cf3/0x3f50 net/ipv6/netfilter/ip6_tables.c:1639 nf_setsockopt+0x28a/0x2b0 net/netfilter/nf_sockopt.c:101 ipv6_setsockopt+0x2f5c/0x43c0 net/ipv6/ipv6_sockglue.c:1015 __sys_setsockopt+0x57e/0x990 net/socket.c:2179 __do_sys_setsockopt net/socket.c:2190 [inline] __se_sys_setsockopt net/socket.c:2187 [inline] __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2187 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:0x7f596e554fd9 Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 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 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffd7eef1128 EFLAGS: 00000246 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f596e554fd9 RDX: 0000000000000040 RSI: 0000000000000029 RDI: 0000000000000003 RBP: 00007f596e518fc0 R08: 0000000000000001 R09: 0000000000000000