================================================================== BUG: KASAN: slab-use-after-free in __list_add_valid+0xf0/0x100 lib/list_debug.c:27 Read of size 8 at addr ffff88807b32a008 by task syz-executor.0/26616 CPU: 1 PID: 26616 Comm: syz-executor.0 Not tainted 6.4.0-rc7-next-20230626-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:364 print_report mm/kasan/report.c:475 [inline] kasan_report+0x11d/0x130 mm/kasan/report.c:588 __list_add_valid+0xf0/0x100 lib/list_debug.c:27 __list_add include/linux/list.h:69 [inline] list_add include/linux/list.h:88 [inline] nfc_llcp_register_device+0x7a8/0x9e0 net/nfc/llcp_core.c:1604 nfc_register_device+0x70/0x3c0 net/nfc/core.c:1124 nci_register_device+0x7cb/0xb50 net/nfc/nci/core.c:1257 virtual_ncidev_open+0x14f/0x230 drivers/nfc/virtual_ncidev.c:148 misc_open+0x383/0x4a0 drivers/char/misc.c:165 chrdev_open+0x273/0x780 fs/char_dev.c:414 do_dentry_open+0x6ce/0x17b0 fs/open.c:914 do_open fs/namei.c:3636 [inline] path_openat+0x1b65/0x2710 fs/namei.c:3793 do_filp_open+0x1ba/0x410 fs/namei.c:3820 do_sys_openat2+0x160/0x1c0 fs/open.c:1407 do_sys_open fs/open.c:1422 [inline] __do_sys_openat fs/open.c:1438 [inline] __se_sys_openat fs/open.c:1433 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1433 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7ff13b28c389 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff13c086168 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ff13b3abf80 RCX: 00007ff13b28c389 RDX: 0000000000000002 RSI: 0000000020000a80 RDI: ffffffffffffff9c RBP: 00007ff13b2d7493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd96e55f5f R14: 00007ff13c086300 R15: 0000000000022000 Allocated by task 26593: kasan_save_stack+0x22/0x40 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 mm/kasan/common.c:333 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:579 [inline] kzalloc include/linux/slab.h:700 [inline] nfc_llcp_register_device+0x49/0x9e0 net/nfc/llcp_core.c:1567 nfc_register_device+0x70/0x3c0 net/nfc/core.c:1124 nci_register_device+0x7cb/0xb50 net/nfc/nci/core.c:1257 virtual_ncidev_open+0x14f/0x230 drivers/nfc/virtual_ncidev.c:148 misc_open+0x383/0x4a0 drivers/char/misc.c:165 chrdev_open+0x273/0x780 fs/char_dev.c:414 do_dentry_open+0x6ce/0x17b0 fs/open.c:914 do_open fs/namei.c:3636 [inline] path_openat+0x1b65/0x2710 fs/namei.c:3793 do_filp_open+0x1ba/0x410 fs/namei.c:3820 do_sys_openat2+0x160/0x1c0 fs/open.c:1407 do_sys_open fs/open.c:1422 [inline] __do_sys_openat fs/open.c:1438 [inline] __se_sys_openat fs/open.c:1433 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1433 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 26589: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:521 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1792 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1818 slab_free mm/slub.c:3801 [inline] __kmem_cache_free+0xb8/0x2d0 mm/slub.c:3814 local_release net/nfc/llcp_core.c:174 [inline] kref_put include/linux/kref.h:65 [inline] nfc_llcp_local_put net/nfc/llcp_core.c:182 [inline] nfc_llcp_local_put net/nfc/llcp_core.c:177 [inline] nfc_llcp_unregister_device+0x1ba/0x260 net/nfc/llcp_core.c:1620 nfc_unregister_device+0x196/0x330 net/nfc/core.c:1179 virtual_ncidev_close+0x52/0xb0 drivers/nfc/virtual_ncidev.c:163 __fput+0x40c/0xad0 fs/file_table.c:378 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb9/0xd0 mm/kasan/generic.c:491 insert_work+0x48/0x360 kernel/workqueue.c:1553 __queue_work+0x625/0x1120 kernel/workqueue.c:1714 queue_work_on+0xf2/0x110 kernel/workqueue.c:1744 queue_work include/linux/workqueue.h:506 [inline] schedule_work include/linux/workqueue.h:567 [inline] rfkill_register+0x67c/0xb00 net/rfkill/core.c:1090 nfc_register_device+0x124/0x3c0 net/nfc/core.c:1132 nci_register_device+0x7cb/0xb50 net/nfc/nci/core.c:1257 virtual_ncidev_open+0x14f/0x230 drivers/nfc/virtual_ncidev.c:148 misc_open+0x383/0x4a0 drivers/char/misc.c:165 chrdev_open+0x273/0x780 fs/char_dev.c:414 do_dentry_open+0x6ce/0x17b0 fs/open.c:914 do_open fs/namei.c:3636 [inline] path_openat+0x1b65/0x2710 fs/namei.c:3793 do_filp_open+0x1ba/0x410 fs/namei.c:3820 do_sys_openat2+0x160/0x1c0 fs/open.c:1407 do_sys_open fs/open.c:1422 [inline] __do_sys_openat fs/open.c:1438 [inline] __se_sys_openat fs/open.c:1433 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1433 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb9/0xd0 mm/kasan/generic.c:491 insert_work+0x48/0x360 kernel/workqueue.c:1553 __queue_work+0x625/0x1120 kernel/workqueue.c:1714 queue_work_on+0xf2/0x110 kernel/workqueue.c:1744 queue_work include/linux/workqueue.h:506 [inline] schedule_work include/linux/workqueue.h:567 [inline] rfkill_register+0x67c/0xb00 net/rfkill/core.c:1090 nfc_register_device+0x124/0x3c0 net/nfc/core.c:1132 nci_register_device+0x7cb/0xb50 net/nfc/nci/core.c:1257 virtual_ncidev_open+0x14f/0x230 drivers/nfc/virtual_ncidev.c:148 misc_open+0x383/0x4a0 drivers/char/misc.c:165 chrdev_open+0x273/0x780 fs/char_dev.c:414 do_dentry_open+0x6ce/0x17b0 fs/open.c:914 do_open fs/namei.c:3636 [inline] path_openat+0x1b65/0x2710 fs/namei.c:3793 do_filp_open+0x1ba/0x410 fs/namei.c:3820 do_sys_openat2+0x160/0x1c0 fs/open.c:1407 do_sys_open fs/open.c:1422 [inline] __do_sys_openat fs/open.c:1438 [inline] __se_sys_openat fs/open.c:1433 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1433 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88807b32a000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 8 bytes inside of freed 2048-byte region [ffff88807b32a000, ffff88807b32a800) The buggy address belongs to the physical page: page:ffffea0001ecca00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7b328 head:ffffea0001ecca00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff888012842000 ffffea0001e98c00 dead000000000002 raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd28c0(GFP_NOWAIT|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5037, tgid 5037 (syz-executor.1), ts 62212982094, free_ts 62187922206 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0xfd9/0x2c40 mm/page_alloc.c:3257 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4513 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279 alloc_slab_page mm/slub.c:1862 [inline] allocate_slab+0x25f/0x390 mm/slub.c:2009 new_slab mm/slub.c:2062 [inline] ___slab_alloc+0xbc3/0x15d0 mm/slub.c:3215 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3314 __slab_alloc_node mm/slub.c:3367 [inline] slab_alloc_node mm/slub.c:3460 [inline] __kmem_cache_alloc_node+0x143/0x350 mm/slub.c:3509 __do_kmalloc_node mm/slab_common.c:984 [inline] __kmalloc_node_track_caller+0x4f/0x1a0 mm/slab_common.c:1005 kmalloc_reserve+0xf0/0x270 net/core/skbuff.c:575 pskb_expand_head+0x22e/0x1170 net/core/skbuff.c:2042 netlink_trim+0x1ea/0x240 net/netlink/af_netlink.c:1321 netlink_broadcast+0x63/0xd90 net/netlink/af_netlink.c:1517 nlmsg_multicast include/net/netlink.h:1083 [inline] nlmsg_notify+0x93/0x280 net/netlink/af_netlink.c:2592 rtnl_notify net/core/rtnetlink.c:771 [inline] rtmsg_ifinfo_send net/core/rtnetlink.c:4045 [inline] rtmsg_ifinfo_event net/core/rtnetlink.c:4061 [inline] rtmsg_ifinfo_event net/core/rtnetlink.c:4048 [inline] rtnetlink_event+0x178/0x1f0 net/core/rtnetlink.c:6475 notifier_call_chain+0xb6/0x3c0 kernel/notifier.c:93 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1161 [inline] free_unref_page_prepare+0x62e/0xcb0 mm/page_alloc.c:2384 free_unref_page+0x33/0x370 mm/page_alloc.c:2479 __unfreeze_partials+0x1fe/0x220 mm/slub.c:2647 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x195/0x220 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:750 [inline] slab_alloc_node mm/slub.c:3470 [inline] slab_alloc mm/slub.c:3478 [inline] __kmem_cache_alloc_lru mm/slub.c:3485 [inline] kmem_cache_alloc+0x16c/0x380 mm/slub.c:3494 getname_flags.part.0+0x50/0x4f0 fs/namei.c:140 getname_flags include/linux/audit.h:319 [inline] getname+0x92/0xd0 fs/namei.c:219 do_sys_openat2+0xe8/0x1c0 fs/open.c:1401 do_sys_open fs/open.c:1422 [inline] __do_sys_openat fs/open.c:1438 [inline] __se_sys_openat fs/open.c:1433 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1433 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88807b329f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807b329f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807b32a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807b32a080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807b32a100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================