================================================================== BUG: KASAN: slab-use-after-free in sysfs_remove_file_ns+0x3d/0x70 fs/sysfs/file.c:510 Read of size 8 at addr ffff88802824a230 by task syz.3.133/6530 CPU: 0 UID: 0 PID: 6530 Comm: syz.3.133 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xca/0x240 mm/kasan/report.c:482 kasan_report+0x118/0x150 mm/kasan/report.c:595 sysfs_remove_file_ns+0x3d/0x70 fs/sysfs/file.c:510 remove_bind_files drivers/base/bus.c:605 [inline] bus_remove_driver+0x198/0x2f0 drivers/base/bus.c:743 comedi_device_detach_locked+0x175/0x750 drivers/comedi/drivers.c:207 do_devconfig_ioctl drivers/comedi/comedi_fops.c:848 [inline] comedi_unlocked_ioctl+0xcde/0x1020 drivers/comedi/comedi_fops.c:2178 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f678658eba9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f67873f0038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f67867d6180 RCX: 00007f678658eba9 RDX: 0000000000000000 RSI: 0000000040946400 RDI: 0000000000000005 RBP: 00007f6786611e19 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f67867d6218 R14: 00007f67867d6180 R15: 00007ffe88660008 Allocated by task 6495: kasan_save_stack mm/kasan/common.c:56 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:77 poison_kmalloc_redzone mm/kasan/common.c:397 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:414 kasan_kmalloc include/linux/kasan.h:260 [inline] __do_kmalloc_node mm/slub.c:5366 [inline] __kvmalloc_node_noprof+0x5cd/0x910 mm/slub.c:6527 __bch2_darray_resize_noprof+0xdc/0x290 fs/bcachefs/darray.c:24 bch2_save_backtrace+0x26f/0x2a0 fs/bcachefs/util.c:298 btree_trans_restart_ip fs/bcachefs/btree_iter.h:364 [inline] __bch2_trans_kmalloc+0x4ee/0x9d0 fs/bcachefs/btree_iter.c:3236 bch2_trans_kmalloc_nomemzero_ip fs/bcachefs/btree_iter.h:586 [inline] bch2_trans_kmalloc_nomemzero fs/bcachefs/btree_iter.h:621 [inline] bch2_alloc_sectors_start_trans+0x1d59/0x1e80 fs/bcachefs/alloc_foreground.c:1251 __bch2_btree_node_alloc fs/bcachefs/btree_update_interior.c:320 [inline] bch2_btree_reserve_get+0x641/0x1810 fs/bcachefs/btree_update_interior.c:534 bch2_btree_update_start+0x147b/0x1de0 fs/bcachefs/btree_update_interior.c:1270 bch2_btree_split_leaf+0x14b/0x8e0 fs/bcachefs/btree_update_interior.c:1921 bch2_trans_commit_error+0x1b7/0x1130 fs/bcachefs/btree_trans_commit.c:914 __bch2_trans_commit+0x1bb5/0x8880 fs/bcachefs/btree_trans_commit.c:1104 bch2_trans_commit fs/bcachefs/btree_update.h:241 [inline] bch2_dev_freespace_init+0x904/0xf60 fs/bcachefs/alloc_background.c:2371 bch2_fs_freespace_init+0xff/0x330 fs/bcachefs/alloc_background.c:2422 bch2_fs_initialize+0xd76/0x1550 fs/bcachefs/recovery.c:1240 bch2_fs_start+0xaa0/0xda0 fs/bcachefs/super.c:1214 bch2_fs_get_tree+0xb39/0x1520 fs/bcachefs/fs.c:2488 vfs_get_tree+0x8f/0x2b0 fs/super.c:1751 fc_mount fs/namespace.c:1274 [inline] do_new_mount_fc fs/namespace.c:3726 [inline] do_new_mount+0x302/0xa10 fs/namespace.c:3802 do_mount fs/namespace.c:4125 [inline] __do_sys_mount fs/namespace.c:4324 [inline] __se_sys_mount+0x313/0x410 fs/namespace.c:4301 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 6495: kasan_save_stack mm/kasan/common.c:56 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:77 __kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:587 kasan_save_free_info mm/kasan/kasan.h:406 [inline] poison_slab_object mm/kasan/common.c:252 [inline] __kasan_slab_free+0x5b/0x80 mm/kasan/common.c:284 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2484 [inline] slab_free mm/slub.c:6121 [inline] kfree+0x199/0x6d0 mm/slub.c:6329 bch2_trans_put+0x87a/0x1220 fs/bcachefs/btree_iter.c:3585 bch2_dev_freespace_init+0xd0f/0xf60 fs/bcachefs/alloc_background.c:2386 bch2_fs_freespace_init+0xff/0x330 fs/bcachefs/alloc_background.c:2422 bch2_fs_initialize+0xd76/0x1550 fs/bcachefs/recovery.c:1240 bch2_fs_start+0xaa0/0xda0 fs/bcachefs/super.c:1214 bch2_fs_get_tree+0xb39/0x1520 fs/bcachefs/fs.c:2488 vfs_get_tree+0x8f/0x2b0 fs/super.c:1751 fc_mount fs/namespace.c:1274 [inline] do_new_mount_fc fs/namespace.c:3726 [inline] do_new_mount+0x302/0xa10 fs/namespace.c:3802 do_mount fs/namespace.c:4125 [inline] __do_sys_mount fs/namespace.c:4324 [inline] __se_sys_mount+0x313/0x410 fs/namespace.c:4301 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88802824a200 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 48 bytes inside of freed 256-byte region [ffff88802824a200, ffff88802824a300) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2824a head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 ksm flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801a841b40 ffffea0001e4d980 dead000000000003 raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801a841b40 ffffea0001e4d980 dead000000000003 head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000001 ffffea0000a09281 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000002 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0x252800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_THISNODE), pid 2985, tgid 2985 (kworker/u8:9), ts 98448899301, free_ts 98271049278 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1850 prep_new_page mm/page_alloc.c:1858 [inline] get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3854 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5144 alloc_slab_page mm/slub.c:2998 [inline] allocate_slab+0x65/0x330 mm/slub.c:3164 new_slab mm/slub.c:3218 [inline] ___slab_alloc+0xbd1/0x13f0 mm/slub.c:4420 __slab_alloc+0x55/0xa0 mm/slub.c:4511 __slab_alloc_node mm/slub.c:4586 [inline] slab_alloc_node mm/slub.c:4996 [inline] __do_kmalloc_node mm/slub.c:5365 [inline] __kmalloc_node_noprof+0x5cc/0x800 mm/slub.c:5372 kmalloc_array_node_noprof include/linux/slab.h:1071 [inline] alloc_slab_obj_exts mm/slub.c:2095 [inline] account_slab mm/slub.c:3123 [inline] allocate_slab+0x160/0x330 mm/slub.c:3183 new_slab mm/slub.c:3218 [inline] ___slab_alloc+0xbd1/0x13f0 mm/slub.c:4420 __slab_alloc+0x55/0xa0 mm/slub.c:4511 __slab_alloc_node mm/slub.c:4586 [inline] slab_alloc_node mm/slub.c:4996 [inline] kmem_cache_alloc_noprof+0x3f9/0x6e0 mm/slub.c:5015 node_alloc net/ipv6/ip6_fib.c:188 [inline] fib6_add_1+0x9c1/0x1460 net/ipv6/ip6_fib.c:-1 fib6_add+0x204/0x18a0 net/ipv6/ip6_fib.c:1440 __ip6_ins_rt net/ipv6/route.c:1351 [inline] ip6_ins_rt+0xc8/0x120 net/ipv6/route.c:1361 __ipv6_ifa_notify+0x63f/0xac0 net/ipv6/addrconf.c:6283 ipv6_ifa_notify net/ipv6/addrconf.c:6322 [inline] addrconf_dad_completed+0x180/0xd60 net/ipv6/addrconf.c:4320 page last free pid 15 tgid 15 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1394 [inline] __free_frozen_pages+0xbc4/0xd30 mm/page_alloc.c:2891 rcu_do_batch kernel/rcu/tree.c:2605 [inline] rcu_core+0xca8/0x1770 kernel/rcu/tree.c:2861 handle_softirqs+0x286/0x870 kernel/softirq.c:579 run_ksoftirqd+0x9b/0x100 kernel/softirq.c:968 smpboot_thread_fn+0x53f/0xa60 kernel/smpboot.c:160 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x47c/0x820 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff88802824a100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802824a180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88802824a200: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802824a280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802824a300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================