BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1497 in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 4165, name: syz-executor340 1 lock held by syz-executor340/4165: #0: ffffffff8c1418b8 (css_set_lock){....}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:388 [inline] #0: ffffffff8c1418b8 (css_set_lock){....}-{2:2}, at: cgroup_get_from_path+0x26/0x2f0 kernel/cgroup/cgroup.c:6627 irq event stamp: 15512 hardirqs last enabled at (15511): [] raw_spin_rq_unlock_irq kernel/sched/sched.h:1338 [inline] hardirqs last enabled at (15511): [] finish_lock_switch+0x12f/0x280 kernel/sched/core.c:4784 hardirqs last disabled at (15512): [] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:126 [inline] hardirqs last disabled at (15512): [] _raw_spin_lock_irq+0x7a/0xe0 kernel/locking/spinlock.c:170 softirqs last enabled at (15484): [] do_ipv6_setsockopt net/ipv6/ipv6_sockglue.c:985 [inline] softirqs last enabled at (15484): [] ipv6_setsockopt+0x1c38/0x3890 net/ipv6/ipv6_sockglue.c:1009 softirqs last disabled at (15482): [] spin_lock_bh include/linux/spinlock.h:368 [inline] softirqs last disabled at (15482): [] release_sock+0x2b/0x1b0 net/core/sock.c:3264 Preemption disabled at: [<0000000000000000>] 0x0 CPU: 0 PID: 4165 Comm: syz-executor340 Not tainted 5.15.185-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106 ___might_sleep+0x47c/0x600 kernel/sched/core.c:9639 down_read+0x20/0x2e0 kernel/locking/rwsem.c:1497 kernfs_walk_and_get_ns+0x81/0x2b0 fs/kernfs/dir.c:908 kernfs_walk_and_get include/linux/kernfs.h:559 [inline] cgroup_get_from_path+0x5f/0x2f0 kernel/cgroup/cgroup.c:6629 cgroup_mt_check_v1+0x1ae/0x2c0 net/netfilter/xt_cgroup.c:56 xt_check_match+0x3c6/0xaa0 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+0x153d/0x2020 net/ipv6/netfilter/ip6_tables.c:735 do_replace net/ipv6/netfilter/ip6_tables.c:1156 [inline] do_ip6t_set_ctl+0x975/0xd00 net/ipv6/netfilter/ip6_tables.c:1646 nf_setsockopt+0x25f/0x280 net/netfilter/nf_sockopt.c:101 ipv6_setsockopt+0x1cb8/0x3890 net/ipv6/ipv6_sockglue.c:1014 tcp_setsockopt+0x21a/0x1d70 net/ipv4/tcp.c:3713 __sys_setsockopt+0x3d6/0x5e0 net/socket.c:2203 __do_sys_setsockopt net/socket.c:2214 [inline] __se_sys_setsockopt net/socket.c:2211 [inline] __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2211 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f68c836f929 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:00007ffc12664038 EFLAGS: 00000246 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 00007ffc12664208 RCX: 00007f68c836f929 RDX: 0000000000000040 RSI: 0000000000000029 RDI: 0000000000000003 RBP: 00007f68c83e3610 R08: 0000000000001528 R09: 00007ffc12664208 R10: 0000200000002800 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffc126641f8 R14: 0000000000000001 R15: 0000000000000001 ============================= [ BUG: Invalid wait context ] 5.15.185-syzkaller #0 Tainted: G W ----------------------------- syz-executor340/4165 is trying to lock: ffffffff8c24e230 (kernfs_rwsem){++++}-{3:3}, at: kernfs_walk_and_get_ns+0x81/0x2b0 fs/kernfs/dir.c:908 other info that might help us debug this: context-{4:4} 1 lock held by syz-executor340/4165: #0: ffffffff8c1418b8 (css_set_lock){....}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:388 [inline] #0: ffffffff8c1418b8 (css_set_lock){....}-{2:2}, at: cgroup_get_from_path+0x26/0x2f0 kernel/cgroup/cgroup.c:6627 stack backtrace: CPU: 0 PID: 4165 Comm: syz-executor340 Tainted: G W 5.15.185-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106 print_lock_invalid_wait_context kernel/locking/lockdep.c:4664 [inline] check_wait_context kernel/locking/lockdep.c:4725 [inline] __lock_acquire+0x1be9/0x7c60 kernel/locking/lockdep.c:4962 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623 down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498 kernfs_walk_and_get_ns+0x81/0x2b0 fs/kernfs/dir.c:908 kernfs_walk_and_get include/linux/kernfs.h:559 [inline] cgroup_get_from_path+0x5f/0x2f0 kernel/cgroup/cgroup.c:6629 cgroup_mt_check_v1+0x1ae/0x2c0 net/netfilter/xt_cgroup.c:56 xt_check_match+0x3c6/0xaa0 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+0x153d/0x2020 net/ipv6/netfilter/ip6_tables.c:735 do_replace net/ipv6/netfilter/ip6_tables.c:1156 [inline] do_ip6t_set_ctl+0x975/0xd00 net/ipv6/netfilter/ip6_tables.c:1646 nf_setsockopt+0x25f/0x280 net/netfilter/nf_sockopt.c:101 ipv6_setsockopt+0x1cb8/0x3890 net/ipv6/ipv6_sockglue.c:1014 tcp_setsockopt+0x21a/0x1d70 net/ipv4/tcp.c:3713 __sys_setsockopt+0x3d6/0x5e0 net/socket.c:2203 __do_sys_setsockopt net/socket.c:2214 [inline] __se_sys_setsockopt net/socket.c:2211 [inline] __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2211 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f68c836f929 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:00007ffc12664038 EFLAGS: 00000246 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 00007ffc12664208 RCX: 00007f68c836f929 RDX: 0000000000000040 RSI: 0000000000000029 RDI: 0000000000000003 RBP: 00007f68c83e3610 R08: 0000000000001528 R09: 000