================================================================== BUG: KASAN: slab-use-after-free in sysfs_remove_file_ns+0x63/0x70 fs/sysfs/file.c:510 Read of size 8 at addr ffff88807dadb630 by task syz.4.802/8899 CPU: 0 UID: 0 PID: 8899 Comm: syz.4.802 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xcd/0x630 mm/kasan/report.c:482 kasan_report+0xe0/0x110 mm/kasan/report.c:595 sysfs_remove_file_ns+0x63/0x70 fs/sysfs/file.c:510 sysfs_remove_file include/linux/sysfs.h:770 [inline] driver_remove_file drivers/base/driver.c:201 [inline] driver_remove_file+0x4a/0x60 drivers/base/driver.c:197 remove_bind_files drivers/base/bus.c:605 [inline] bus_remove_driver+0x224/0x2c0 drivers/base/bus.c:743 driver_unregister+0x76/0xb0 drivers/base/driver.c:277 comedi_device_detach_locked+0x12f/0xa50 drivers/comedi/drivers.c:207 do_devconfig_ioctl+0x555/0x710 drivers/comedi/comedi_fops.c:848 comedi_unlocked_ioctl+0x165d/0x2f00 drivers/comedi/comedi_fops.c:2178 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7faf29d8eec9 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:00007faf2ab72038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007faf29fe6180 RCX: 00007faf29d8eec9 RDX: 0000000000000000 RSI: 0000000040946400 RDI: 0000000000000006 RBP: 00007faf29e11f91 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007faf29fe6218 R14: 00007faf29fe6180 R15: 00007ffc88035e98 Allocated by task 8705: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_save_track+0x14/0x30 mm/kasan/common.c:77 poison_kmalloc_redzone mm/kasan/common.c:400 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:417 kasan_kmalloc include/linux/kasan.h:262 [inline] __do_kmalloc_node mm/slub.c:5627 [inline] __kmalloc_noprof+0x32f/0x880 mm/slub.c:5639 kmalloc_noprof include/linux/slab.h:961 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] hash_ipportnet6_add+0x271b/0x30a0 net/netfilter/ipset/ip_set_hash_gen.h:950 hash_ipportnet6_uadt+0xab7/0x1010 net/netfilter/ipset/ip_set_hash_ipportnet.c:504 call_ad.constprop.0+0x16e/0x940 net/netfilter/ipset/ip_set_core.c:1751 ip_set_ad.constprop.0.isra.0+0x3ce/0x870 net/netfilter/ipset/ip_set_core.c:1841 nfnetlink_rcv_msg+0x9fc/0x1200 net/netfilter/nfnetlink.c:302 netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 nfnetlink_rcv+0x1b3/0x430 net/netfilter/nfnetlink.c:669 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] netlink_unicast+0x5aa/0x870 net/netlink/af_netlink.c:1346 netlink_sendmsg+0x8c8/0xdd0 net/netlink/af_netlink.c:1896 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg net/socket.c:742 [inline] ____sys_sendmsg+0xa98/0xc70 net/socket.c:2630 ___sys_sendmsg+0x134/0x1d0 net/socket.c:2684 __sys_sendmsg+0x16d/0x220 net/socket.c:2716 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 8705: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_save_track+0x14/0x30 mm/kasan/common.c:77 __kasan_save_free_info+0x3b/0x60 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+0x5f/0x80 mm/kasan/common.c:284 kasan_slab_free include/linux/kasan.h:234 [inline] slab_free_hook mm/slub.c:2523 [inline] slab_free mm/slub.c:6611 [inline] kfree+0x2b8/0x6d0 mm/slub.c:6818 hash_ipportnet6_ahash_destroy+0x66/0x1e0 net/netfilter/ipset/ip_set_hash_gen.h:441 hash_ipportnet6_resize+0x17ed/0x1e70 net/netfilter/ipset/ip_set_hash_gen.h:781 call_ad.constprop.0+0x36d/0x940 net/netfilter/ipset/ip_set_core.c:1757 ip_set_ad.constprop.0.isra.0+0x3ce/0x870 net/netfilter/ipset/ip_set_core.c:1841 nfnetlink_rcv_msg+0x9fc/0x1200 net/netfilter/nfnetlink.c:302 netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 nfnetlink_rcv+0x1b3/0x430 net/netfilter/nfnetlink.c:669 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] netlink_unicast+0x5aa/0x870 net/netlink/af_netlink.c:1346 netlink_sendmsg+0x8c8/0xdd0 net/netlink/af_netlink.c:1896 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg net/socket.c:742 [inline] ____sys_sendmsg+0xa98/0xc70 net/socket.c:2630 ___sys_sendmsg+0x134/0x1d0 net/socket.c:2684 __sys_sendmsg+0x16d/0x220 net/socket.c:2716 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88807dadb600 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 48 bytes inside of freed 256-byte region [ffff88807dadb600, ffff88807dadb700) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88807dadb600 pfn:0x7dada head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88813ff26b40 ffffea0001b7e000 dead000000000002 raw: ffff88807dadb600 000000000010000f 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88813ff26b40 ffffea0001b7e000 dead000000000002 head: ffff88807dadb600 000000000010000f 00000000f5000000 0000000000000000 head: 00fff00000000001 ffffea0001f6b681 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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5960, tgid 5960 (syz-executor), ts 71034861773, free_ts 71021906345 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1850 prep_new_page mm/page_alloc.c:1858 [inline] get_page_from_freelist+0x10a3/0x3a30 mm/page_alloc.c:3884 __alloc_frozen_pages_noprof+0x25f/0x2470 mm/page_alloc.c:5183 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2416 alloc_slab_page mm/slub.c:3039 [inline] allocate_slab mm/slub.c:3212 [inline] new_slab+0x24a/0x360 mm/slub.c:3266 ___slab_alloc+0xdc4/0x1ae0 mm/slub.c:4636 __slab_alloc.constprop.0+0x63/0x110 mm/slub.c:4755 __slab_alloc_node mm/slub.c:4831 [inline] slab_alloc_node mm/slub.c:5253 [inline] __do_kmalloc_node mm/slub.c:5626 [inline] __kmalloc_noprof+0x501/0x880 mm/slub.c:5639 kmalloc_noprof include/linux/slab.h:961 [inline] kmalloc_array_noprof include/linux/slab.h:1003 [inline] security_inode_init_security+0x13f/0x390 security/security.c:1868 shmem_symlink+0x135/0x9f0 mm/shmem.c:4099 vfs_symlink fs/namei.c:4817 [inline] vfs_symlink+0x403/0x680 fs/namei.c:4801 do_symlinkat+0x261/0x310 fs/namei.c:4843 __do_sys_symlinkat fs/namei.c:4859 [inline] __se_sys_symlinkat fs/namei.c:4856 [inline] __x64_sys_symlinkat+0x93/0xc0 fs/namei.c:4856 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 5805 tgid 5805 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1394 [inline] __free_frozen_pages+0x7df/0x1160 mm/page_alloc.c:2906 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4d/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:352 kasan_slab_alloc include/linux/kasan.h:252 [inline] slab_post_alloc_hook mm/slub.c:4955 [inline] slab_alloc_node mm/slub.c:5265 [inline] __kmalloc_cache_node_noprof+0x28b/0x7a0 mm/slub.c:5756 kmalloc_node_noprof include/linux/slab.h:983 [inline] __get_vm_area_node+0x101/0x330 mm/vmalloc.c:3182 __vmalloc_node_range_noprof+0x271/0x1480 mm/vmalloc.c:3857 __vmalloc_node_noprof+0xad/0xf0 mm/vmalloc.c:3960 alloc_counters net/ipv6/netfilter/ip6_tables.c:815 [inline] copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:837 [inline] get_entries net/ipv6/netfilter/ip6_tables.c:1039 [inline] do_ip6t_get_ctl+0x6b6/0xae0 net/ipv6/netfilter/ip6_tables.c:1677 nf_getsockopt+0x7c/0xe0 net/netfilter/nf_sockopt.c:116 ipv6_getsockopt+0x1f7/0x280 net/ipv6/ipv6_sockglue.c:1473 tcp_getsockopt+0xa1/0x100 net/ipv4/tcp.c:4810 do_sock_getsockopt+0x34d/0x440 net/socket.c:2421 __sys_getsockopt+0x12f/0x260 net/socket.c:2450 __do_sys_getsockopt net/socket.c:2457 [inline] __se_sys_getsockopt net/socket.c:2454 [inline] __x64_sys_getsockopt+0xbd/0x160 net/socket.c:2454 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 Memory state around the buggy address: ffff88807dadb500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807dadb580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807dadb600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807dadb680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807dadb700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================