================================================================== BUG: KASAN: slab-use-after-free in __list_del_entry_valid_or_report+0x174/0x1b0 lib/list_debug.c:65 Read of size 8 at addr ffff88802d0f6008 by task syz-executor.2/14244 CPU: 0 PID: 14244 Comm: syz-executor.2 Not tainted 6.5.0-syzkaller-08894-gb97d64c72259 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 __list_del_entry_valid_or_report+0x174/0x1b0 lib/list_debug.c:65 __list_del_entry_valid include/linux/list.h:124 [inline] __list_del_entry include/linux/list.h:215 [inline] list_del include/linux/list.h:229 [inline] nfc_llcp_remove_local net/nfc/llcp_core.c:306 [inline] nfc_llcp_unregister_device+0xc3/0x2c0 net/nfc/llcp_core.c:1646 nfc_unregister_device+0x194/0x330 net/nfc/core.c:1179 virtual_ncidev_close+0x51/0xa0 drivers/nfc/virtual_ncidev.c:163 __fput+0x3f7/0xa70 fs/file_table.c:384 __fput_sync+0x47/0x50 fs/file_table.c:465 __do_sys_close fs/open.c:1572 [inline] __se_sys_close fs/open.c:1557 [inline] __x64_sys_close+0x87/0xf0 fs/open.c:1557 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f7d6da7b9da Code: 48 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c 24 0c e8 03 7f 02 00 8b 7c 24 0c 89 c2 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 36 89 d7 89 44 24 0c e8 63 7f 02 00 8b 44 24 RSP: 002b:00007ffcb09a2770 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007f7d6da7b9da RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000000000000b RBP: 0000000000000032 R08: 0000001b2fa20000 R09: 00000000000000bf R10: 000000008171fc56 R11: 0000000000000293 R12: 00007f7d6d608e98 R13: ffffffffffffffff R14: 00007f7d6d600000 R15: 000000000002ed1b Allocated by task 14234: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] nfc_llcp_register_device+0x47/0x9d0 net/nfc/llcp_core.c:1602 nfc_register_device+0x6d/0x3c0 net/nfc/core.c:1124 nci_register_device+0x7f4/0xb80 net/nfc/nci/core.c:1257 virtual_ncidev_open+0x147/0x220 drivers/nfc/virtual_ncidev.c:148 misc_open+0x3da/0x4c0 drivers/char/misc.c:165 chrdev_open+0x277/0x700 fs/char_dev.c:414 do_dentry_open+0x88b/0x1730 fs/open.c:929 do_open fs/namei.c:3639 [inline] path_openat+0x19af/0x29c0 fs/namei.c:3796 do_filp_open+0x1de/0x430 fs/namei.c:3823 do_sys_openat2+0x176/0x1e0 fs/open.c:1422 do_sys_open fs/open.c:1437 [inline] __do_sys_openat fs/open.c:1453 [inline] __se_sys_openat fs/open.c:1448 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1448 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 14233: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x138/0x190 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] __cache_free mm/slab.c:3370 [inline] __do_kmem_cache_free mm/slab.c:3557 [inline] __kmem_cache_free+0xcc/0x2d0 mm/slab.c:3564 local_release net/nfc/llcp_core.c:175 [inline] kref_put include/linux/kref.h:65 [inline] nfc_llcp_local_put.part.0+0x88/0xb0 net/nfc/llcp_core.c:183 nfc_llcp_local_put net/nfc/llcp_core.c:180 [inline] nfc_llcp_unregister_device+0x1db/0x2c0 net/nfc/llcp_core.c:1655 nfc_unregister_device+0x194/0x330 net/nfc/core.c:1179 virtual_ncidev_close+0x51/0xa0 drivers/nfc/virtual_ncidev.c:163 __fput+0x3f7/0xa70 fs/file_table.c:384 __fput_sync+0x47/0x50 fs/file_table.c:465 __do_sys_close fs/open.c:1572 [inline] __se_sys_close fs/open.c:1557 [inline] __x64_sys_close+0x87/0xf0 fs/open.c:1557 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492 insert_work+0x4a/0x330 kernel/workqueue.c:1556 __queue_work+0x5f5/0x1040 kernel/workqueue.c:1717 queue_work_on+0xed/0x110 kernel/workqueue.c:1747 queue_work include/linux/workqueue.h:506 [inline] schedule_work include/linux/workqueue.h:567 [inline] rfkill_register+0x67f/0xb00 net/rfkill/core.c:1090 nfc_register_device+0x11f/0x3c0 net/nfc/core.c:1132 nci_register_device+0x7f4/0xb80 net/nfc/nci/core.c:1257 virtual_ncidev_open+0x147/0x220 drivers/nfc/virtual_ncidev.c:148 misc_open+0x3da/0x4c0 drivers/char/misc.c:165 chrdev_open+0x277/0x700 fs/char_dev.c:414 do_dentry_open+0x88b/0x1730 fs/open.c:929 do_open fs/namei.c:3639 [inline] path_openat+0x19af/0x29c0 fs/namei.c:3796 do_filp_open+0x1de/0x430 fs/namei.c:3823 do_sys_openat2+0x176/0x1e0 fs/open.c:1422 do_sys_open fs/open.c:1437 [inline] __do_sys_openat fs/open.c:1453 [inline] __se_sys_openat fs/open.c:1448 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1448 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88802d0f6000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 8 bytes inside of freed 2048-byte region [ffff88802d0f6000, ffff88802d0f6800) The buggy address belongs to the physical page: page:ffffea0000b43d80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2d0f6 flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0x1() raw: 00fff00000000800 ffff888012840800 ffffea000137c550 ffffea0000780c10 raw: 0000000000000000 ffff88802d0f6000 0000000100000001 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 0x3420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 8649, tgid 8648 (syz-executor.3), ts 143592103876, free_ts 143590328818 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536 prep_new_page mm/page_alloc.c:1543 [inline] get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3183 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4439 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1356 [inline] cache_grow_begin+0x99/0x3a0 mm/slab.c:2550 cache_alloc_refill+0x294/0x3a0 mm/slab.c:2923 ____cache_alloc mm/slab.c:2999 [inline] ____cache_alloc mm/slab.c:2982 [inline] __do_cache_alloc mm/slab.c:3182 [inline] slab_alloc_node mm/slab.c:3230 [inline] __kmem_cache_alloc_node+0x3c9/0x470 mm/slab.c:3521 kmalloc_trace+0x25/0xe0 mm/slab_common.c:1114 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] nfc_allocate_device+0x15b/0x5e0 net/nfc/core.c:1065 nci_allocate_device+0x23b/0x430 net/nfc/nci/core.c:1174 virtual_ncidev_open+0x6f/0x220 drivers/nfc/virtual_ncidev.c:136 misc_open+0x3da/0x4c0 drivers/char/misc.c:165 chrdev_open+0x277/0x700 fs/char_dev.c:414 do_dentry_open+0x88b/0x1730 fs/open.c:929 do_open fs/namei.c:3639 [inline] path_openat+0x19af/0x29c0 fs/namei.c:3796 do_filp_open+0x1de/0x430 fs/namei.c:3823 do_sys_openat2+0x176/0x1e0 fs/open.c:1422 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1136 [inline] free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405 selinux_genfs_get_sid security/selinux/hooks.c:1341 [inline] inode_doinit_with_dentry+0xac0/0x12c0 security/selinux/hooks.c:1539 selinux_d_instantiate+0x26/0x30 security/selinux/hooks.c:6278 security_d_instantiate+0x54/0xe0 security/security.c:3799 d_splice_alias+0x94/0xdf0 fs/dcache.c:3145 kernfs_iop_lookup+0x283/0x330 fs/kernfs/dir.c:1204 lookup_open.isra.0+0x8dc/0x1360 fs/namei.c:3473 open_last_lookups fs/namei.c:3563 [inline] path_openat+0x931/0x29c0 fs/namei.c:3793 do_filp_open+0x1de/0x430 fs/namei.c:3823 do_sys_openat2+0x176/0x1e0 fs/open.c:1422 do_sys_open fs/open.c:1437 [inline] __do_sys_openat fs/open.c:1453 [inline] __se_sys_openat fs/open.c:1448 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1448 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88802d0f5f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802d0f5f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88802d0f6000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802d0f6080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802d0f6100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================