================================================================== BUG: KASAN: slab-use-after-free in __release_resource+0x276/0x2c0 kernel/resource.c:221 Read of size 8 at addr ffff88806d72be38 by task syz.5.2033/12420 CPU: 2 UID: 0 PID: 12420 Comm: syz.5.2033 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 __release_resource+0x276/0x2c0 kernel/resource.c:221 release_resource+0x26/0x40 kernel/resource.c:319 pci_free_resources drivers/pci/remove.c:16 [inline] pci_destroy_dev drivers/pci/remove.c:56 [inline] pci_remove_bus_device+0x2d3/0x3b0 drivers/pci/remove.c:110 pci_stop_and_remove_bus_device_locked+0x1a/0x20 drivers/pci/remove.c:136 remove_store+0x123/0x140 drivers/pci/pci-sysfs.c:523 dev_attr_store+0x58/0x80 drivers/base/core.c:2505 sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145 kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:345 new_sync_write fs/read_write.c:595 [inline] vfs_write+0x6ac/0x1050 fs/read_write.c:687 ksys_write+0x12a/0x250 fs/read_write.c:739 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe7/0x970 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf708efec Code: Unable to access opcode bytes at 0xf708efc2. RSP: 002b:00000000f545c50c EFLAGS: 00000292 ORIG_RAX: 0000000000000004 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000080000300 RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 10949: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kasan_kmalloc include/linux/kasan.h:263 [inline] __do_kmalloc_node mm/slub.c:5334 [inline] __kmalloc_node_track_caller_noprof+0x331/0x830 mm/slub.c:5471 __do_krealloc mm/slub.c:6837 [inline] krealloc_node_align_noprof+0x321/0x3e0 mm/slub.c:6858 nf_ct_ext_add+0x1b0/0x3c0 net/netfilter/nf_conntrack_extend.c:115 nf_ct_labels_ext_add include/net/netfilter/nf_conntrack_labels.h:45 [inline] init_conntrack.isra.0+0x6bf/0x1380 net/netfilter/nf_conntrack_core.c:1793 resolve_normal_ct net/netfilter/nf_conntrack_core.c:1898 [inline] nf_conntrack_in+0xe70/0x1690 net/netfilter/nf_conntrack_core.c:2040 nf_hook_entry_hookfn include/linux/netfilter.h:158 [inline] nf_hook_slow+0xbf/0x220 net/netfilter/core.c:619 nf_hook_slow_list+0x1ad/0x460 net/netfilter/core.c:656 NF_HOOK_LIST.constprop.0+0x19a/0x380 include/linux/netfilter.h:354 ip_sublist_rcv net/ipv4/ip_input.c:681 [inline] ip_list_rcv+0x32d/0x450 net/ipv4/ip_input.c:717 __netif_receive_skb_list_ptype net/core/dev.c:6255 [inline] __netif_receive_skb_list_core+0x74c/0x940 net/core/dev.c:6302 __netif_receive_skb_list net/core/dev.c:6354 [inline] netif_receive_skb_list_internal+0x722/0xd40 net/core/dev.c:6445 netif_receive_skb_list net/core/dev.c:6497 [inline] netif_receive_skb_list+0x72/0x500 net/core/dev.c:6487 xdp_recv_frames net/bpf/test_run.c:268 [inline] xdp_test_run_batch.constprop.0+0x16b5/0x1ca0 net/bpf/test_run.c:349 bpf_test_run_xdp_live+0x367/0x760 net/bpf/test_run.c:378 bpf_prog_test_run_xdp+0xd7d/0x1670 net/bpf/test_run.c:1463 bpf_prog_test_run kernel/bpf/syscall.c:4859 [inline] __sys_bpf+0x2a12/0x4e80 kernel/bpf/syscall.c:6436 __do_sys_bpf kernel/bpf/syscall.c:6537 [inline] __se_sys_bpf kernel/bpf/syscall.c:6534 [inline] __ia32_sys_bpf+0xcc/0x170 kernel/bpf/syscall.c:6534 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe7/0x970 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 10949: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2677 [inline] slab_free mm/slub.c:6377 [inline] kfree+0x22b/0x6c0 mm/slub.c:6692 nf_conntrack_free+0x3ab/0x840 net/netfilter/nf_conntrack_core.c:1741 nf_ct_destroy+0x18f/0x5f0 net/netfilter/nf_conntrack_core.c:616 nf_conntrack_destroy+0xb3/0x310 net/netfilter/core.c:712 nf_conntrack_put include/linux/netfilter/nf_conntrack_common.h:37 [inline] nf_reset_ct include/linux/skbuff.h:5139 [inline] skb_release_head_state+0x27d/0x400 net/core/skbuff.c:1188 skb_release_all net/core/skbuff.c:1195 [inline] __kfree_skb net/core/skbuff.c:1211 [inline] sk_skb_reason_drop+0xc4/0x1b0 net/core/skbuff.c:1250 kfree_skb_reason include/linux/skbuff.h:1323 [inline] ip_rcv_finish_core+0x114f/0x2c30 net/ipv4/ip_input.c:469 ip_list_rcv_finish+0x2ba/0xce0 net/ipv4/ip_input.c:658 ip_sublist_rcv net/ipv4/ip_input.c:683 [inline] ip_list_rcv+0x338/0x450 net/ipv4/ip_input.c:717 __netif_receive_skb_list_ptype net/core/dev.c:6255 [inline] __netif_receive_skb_list_core+0x74c/0x940 net/core/dev.c:6302 __netif_receive_skb_list net/core/dev.c:6354 [inline] netif_receive_skb_list_internal+0x722/0xd40 net/core/dev.c:6445 netif_receive_skb_list net/core/dev.c:6497 [inline] netif_receive_skb_list+0x72/0x500 net/core/dev.c:6487 xdp_recv_frames net/bpf/test_run.c:268 [inline] xdp_test_run_batch.constprop.0+0x16b5/0x1ca0 net/bpf/test_run.c:349 bpf_test_run_xdp_live+0x367/0x760 net/bpf/test_run.c:378 bpf_prog_test_run_xdp+0xd7d/0x1670 net/bpf/test_run.c:1463 bpf_prog_test_run kernel/bpf/syscall.c:4859 [inline] __sys_bpf+0x2a12/0x4e80 kernel/bpf/syscall.c:6436 __do_sys_bpf kernel/bpf/syscall.c:6537 [inline] __se_sys_bpf kernel/bpf/syscall.c:6534 [inline] __ia32_sys_bpf+0xcc/0x170 kernel/bpf/syscall.c:6534 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe7/0x970 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff88806d72be00 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 56 bytes inside of freed 128-byte region [ffff88806d72be00, ffff88806d72be80) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88806d72be00 pfn:0x6d72b flags: 0x4fff00000000200(workingset|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000200 ffff88801bc42a00 ffffea0001b65390 ffffea0001aa7310 raw: ffff88806d72be00 0000000800100003 00000000f5000000 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6634, tgid 6633 (syz.4.265), ts 79770418710, free_ts 59820175797 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859 prep_new_page mm/page_alloc.c:1867 [inline] get_page_from_freelist+0xf48/0x3530 mm/page_alloc.c:3946 __alloc_frozen_pages_noprof+0x299/0x2dc0 mm/page_alloc.c:5304 alloc_slab_page mm/slub.c:3266 [inline] allocate_slab mm/slub.c:3380 [inline] new_slab+0xa2/0x640 mm/slub.c:3426 refill_objects+0xe3/0x410 mm/slub.c:7310 refill_sheaf mm/slub.c:2804 [inline] __pcs_replace_empty_main+0x376/0x680 mm/slub.c:4675 alloc_from_pcs mm/slub.c:4773 [inline] slab_alloc_node mm/slub.c:4905 [inline] __do_kmalloc_node mm/slub.c:5333 [inline] __kmalloc_noprof+0x66d/0x820 mm/slub.c:5359 _kmalloc_noprof include/linux/slab.h:992 [inline] _kzalloc_noprof include/linux/slab.h:1309 [inline] hash_netportnet6_resize+0xdb2/0x1e20 net/netfilter/ipset/ip_set_hash_gen.h:721 call_ad.isra.0+0x36d/0x940 net/netfilter/ipset/ip_set_core.c:1764 ip_set_ad.isra.0+0x3eb/0x8a0 net/netfilter/ipset/ip_set_core.c:1848 nfnetlink_rcv_msg+0x9d5/0x11e0 net/netfilter/nfnetlink.c:300 netlink_rcv_skb+0x159/0x420 net/netlink/af_netlink.c:2556 nfnetlink_rcv+0x1b3/0x440 net/netfilter/nfnetlink.c:667 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x585/0x850 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x8b0/0xda0 net/netlink/af_netlink.c:1900 sock_sendmsg_nosec net/socket.c:775 [inline] __sock_sendmsg net/socket.c:790 [inline] ____sys_sendmsg+0xa4d/0xbe0 net/socket.c:2684 page last free pid 6171 tgid 6171 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1406 [inline] __free_frozen_pages+0x79f/0x1090 mm/page_alloc.c:2950 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x47/0xf0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:350 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4584 [inline] slab_alloc_node mm/slub.c:4917 [inline] kmem_cache_alloc_noprof+0x26b/0x6a0 mm/slub.c:4931 vm_area_dup+0x27/0x8e0 mm/vma_init.c:123 dup_mmap+0x6f6/0x21b0 mm/mmap.c:1786 dup_mm kernel/fork.c:1543 [inline] copy_mm kernel/fork.c:1595 [inline] copy_process+0x4588/0x8030 kernel/fork.c:2289 kernel_clone+0x176/0x9d0 kernel/fork.c:2748 __do_sys_clone+0xd9/0x120 kernel/fork.c:2889 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x840 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88806d72bd00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806d72bd80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88806d72be00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806d72be80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88806d72bf00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================