================================================================== BUG: KASAN: slab-use-after-free in __release_resource+0x276/0x2c0 kernel/resource.c:221 Read of size 8 at addr ffff8880594f5b38 by task syz.2.891/9220 CPU: 3 UID: 0 PID: 9220 Comm: syz.2.891 Not tainted syzkaller #0 PREEMPT(full) 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_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f7393f9de99 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f7394def028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f7394225fa0 RCX: 00007f7393f9de99 RDX: 0000000000000001 RSI: 00002000000000c0 RDI: 0000000000000004 RBP: 00007f7394033eaf R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f7394226038 R14: 00007f7394225fa0 R15: 00007ffd3adebe68 Allocated by task 7979: 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 kmemdup_noprof+0x29/0x60 mm/util.c:138 platform_device_add_resources+0x37/0x100 drivers/base/platform.c:657 dwc2_pci_probe+0x1d3/0x360 drivers/usb/dwc2/pci.c:94 local_pci_probe+0xdd/0x1b0 drivers/pci/pci-driver.c:332 pci_call_probe+0x176/0x800 drivers/pci/pci-driver.c:394 __pci_device_probe drivers/pci/pci-driver.c:455 [inline] pci_device_probe+0x1cd/0x370 drivers/pci/pci-driver.c:489 call_driver_probe drivers/base/dd.c:628 [inline] really_probe+0x241/0xa60 drivers/base/dd.c:706 __driver_probe_device+0x20e/0x450 drivers/base/dd.c:868 driver_probe_device+0x4a/0x140 drivers/base/dd.c:898 __driver_attach+0x21f/0x5b0 drivers/base/dd.c:1292 bus_for_each_dev+0x13e/0x1d0 drivers/base/bus.c:383 pci_add_dynid+0x2b5/0x370 drivers/pci/pci-driver.c:77 new_id_store+0x2a9/0x5b0 drivers/pci/pci-driver.c:249 drv_attr_store+0x74/0xb0 drivers/base/bus.c:125 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_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 9220: 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 platform_device_release+0x8a/0xb0 drivers/base/platform.c:605 device_release+0xd2/0x270 drivers/base/core.c:2636 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1f7/0x640 lib/kobject.c:737 put_device+0x1f/0x30 drivers/base/core.c:3880 platform_device_put drivers/base/platform.c:593 [inline] platform_device_unregister+0x45/0x50 drivers/base/platform.c:840 dwc2_pci_remove+0x55/0xd0 drivers/usb/dwc2/pci.c:46 pci_device_remove+0xb2/0x1d0 drivers/pci/pci-driver.c:512 device_remove+0xcb/0x180 drivers/base/dd.c:616 __device_release_driver drivers/base/dd.c:1349 [inline] device_release_driver_internal+0x44e/0x620 drivers/base/dd.c:1372 pci_stop_dev drivers/pci/remove.c:27 [inline] pci_stop_bus_device+0x120/0x160 drivers/pci/remove.c:93 pci_stop_and_remove_bus_device+0x58/0xa0 drivers/pci/remove.c:128 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_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff8880594f5b00 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 56 bytes inside of freed 128-byte region [ffff8880594f5b00, ffff8880594f5b80) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff8880594f5800 pfn:0x594f5 flags: 0xfff00000000200(workingset|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000200 ffff88801bc42a00 ffffea0000d40690 ffffea00017cdc10 raw: ffff8880594f5800 0000000800100004 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 5738, tgid 5738 (syz-executor), ts 50033344462, free_ts 0 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] __kmalloc_cache_noprof+0x479/0x6c0 mm/slub.c:5485 _kmalloc_noprof include/linux/slab.h:988 [inline] __hw_addr_create+0x57/0x220 net/core/dev_addr_lists.c:62 __hw_addr_add_ex+0x32b/0x650 net/core/dev_addr_lists.c:120 __hw_addr_sync_one net/core/dev_addr_lists.c:218 [inline] __hw_addr_sync+0x15b/0x270 net/core/dev_addr_lists.c:281 ieee80211_set_multicast_list+0x183/0x230 net/mac80211/iface.c:891 __dev_set_rx_mode+0x332/0x400 net/core/dev_addr_lists.c:1387 __dev_mc_add net/core/dev_addr_lists.c:1002 [inline] dev_mc_add+0xee/0x110 net/core/dev_addr_lists.c:1016 ip_mc_filter_add net/ipv4/igmp.c:1186 [inline] igmp_group_added+0x83a/0x9a0 net/ipv4/igmp.c:1375 ____ip_mc_inc_group+0x7e3/0x10d0 net/ipv4/igmp.c:1591 __ip_mc_inc_group net/ipv4/igmp.c:1601 [inline] ip_mc_inc_group net/ipv4/igmp.c:1607 [inline] ip_mc_up+0x154/0x390 net/ipv4/igmp.c:1912 page_owner free stack trace missing Memory state around the buggy address: ffff8880594f5a00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880594f5a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880594f5b00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880594f5b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880594f5c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================