================================================================== BUG: KASAN: slab-use-after-free in __list_add_valid+0x4c/0xf0 lib/list_debug.c:27 Read of size 8 at addr ffff888076af1008 by task syz-executor.0/7812 CPU: 1 PID: 7812 Comm: syz-executor.0 Not tainted 6.4.0-rc7-syzkaller-00072-gdad9774deaf1 #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+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:351 [inline] print_report+0x163/0x540 mm/kasan/report.c:462 kasan_report+0x176/0x1b0 mm/kasan/report.c:572 __list_add_valid+0x4c/0xf0 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+0x6cf/0x800 net/nfc/llcp_core.c:1604 nfc_register_device+0x71/0x320 net/nfc/core.c:1124 nci_register_device+0x7c2/0x900 net/nfc/nci/core.c:1257 virtual_ncidev_open+0x13c/0x1b0 drivers/nfc/virtual_ncidev.c:148 misc_open+0x308/0x380 drivers/char/misc.c:165 chrdev_open+0x54e/0x630 fs/char_dev.c:414 do_dentry_open+0x7f9/0x10f0 fs/open.c:920 do_open fs/namei.c:3636 [inline] path_openat+0x27b3/0x3170 fs/namei.c:3791 do_filp_open+0x234/0x490 fs/namei.c:3818 do_sys_openat2+0x13f/0x500 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_openat fs/open.c:1388 [inline] __se_sys_openat fs/open.c:1383 [inline] __x64_sys_openat+0x247/0x290 fs/open.c:1383 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f6a55e8c389 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:00007f6a56c87168 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f6a55fabf80 RCX: 00007f6a55e8c389 RDX: 0000000000000002 RSI: 00000000200025c0 RDI: ffffffffffffff9c RBP: 00007f6a55ed7493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffca434c6ef R14: 00007f6a56c87300 R15: 0000000000022000 Allocated by task 7796: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [inline] nfc_llcp_register_device+0x55/0x800 net/nfc/llcp_core.c:1567 nfc_register_device+0x71/0x320 net/nfc/core.c:1124 nci_register_device+0x7c2/0x900 net/nfc/nci/core.c:1257 virtual_ncidev_open+0x13c/0x1b0 drivers/nfc/virtual_ncidev.c:148 misc_open+0x308/0x380 drivers/char/misc.c:165 chrdev_open+0x54e/0x630 fs/char_dev.c:414 do_dentry_open+0x7f9/0x10f0 fs/open.c:920 do_open fs/namei.c:3636 [inline] path_openat+0x27b3/0x3170 fs/namei.c:3791 do_filp_open+0x234/0x490 fs/namei.c:3818 do_sys_openat2+0x13f/0x500 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_openat fs/open.c:1388 [inline] __se_sys_openat fs/open.c:1383 [inline] __x64_sys_openat+0x247/0x290 fs/open.c:1383 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 7795: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:521 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook mm/slub.c:1807 [inline] slab_free mm/slub.c:3786 [inline] __kmem_cache_free+0x264/0x3c0 mm/slub.c:3799 local_release net/nfc/llcp_core.c:174 [inline] kref_put include/linux/kref.h:65 [inline] nfc_llcp_local_put+0x150/0x180 net/nfc/llcp_core.c:182 nfc_unregister_device+0x167/0x2a0 net/nfc/core.c:1179 virtual_ncidev_close+0x59/0x90 drivers/nfc/virtual_ncidev.c:163 __fput+0x3b7/0x890 fs/file_table.c:321 task_work_run+0x24a/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:491 insert_work+0x54/0x3d0 kernel/workqueue.c:1365 __queue_work+0xb37/0xf10 kernel/workqueue.c:1526 queue_work_on+0x14f/0x250 kernel/workqueue.c:1554 queue_work include/linux/workqueue.h:505 [inline] schedule_work include/linux/workqueue.h:566 [inline] rfkill_register+0x729/0x880 net/rfkill/core.c:1090 nfc_register_device+0x148/0x320 net/nfc/core.c:1132 nci_register_device+0x7c2/0x900 net/nfc/nci/core.c:1257 virtual_ncidev_open+0x13c/0x1b0 drivers/nfc/virtual_ncidev.c:148 misc_open+0x308/0x380 drivers/char/misc.c:165 chrdev_open+0x54e/0x630 fs/char_dev.c:414 do_dentry_open+0x7f9/0x10f0 fs/open.c:920 do_open fs/namei.c:3636 [inline] path_openat+0x27b3/0x3170 fs/namei.c:3791 do_filp_open+0x234/0x490 fs/namei.c:3818 do_sys_openat2+0x13f/0x500 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_openat fs/open.c:1388 [inline] __se_sys_openat fs/open.c:1383 [inline] __x64_sys_openat+0x247/0x290 fs/open.c:1383 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:491 __call_rcu_common kernel/rcu/tree.c:2627 [inline] call_rcu+0x167/0xa70 kernel/rcu/tree.c:2741 netlink_release+0x146a/0x18f0 net/netlink/af_netlink.c:828 __sock_release net/socket.c:653 [inline] sock_close+0xd1/0x230 net/socket.c:1397 __fput+0x3b7/0x890 fs/file_table.c:321 task_work_run+0x24a/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888076af1000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 8 bytes inside of freed 2048-byte region [ffff888076af1000, ffff888076af1800) The buggy address belongs to the physical page: page:ffffea0001dabc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x76af0 head:ffffea0001dabc00 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 ffff888012442000 dead000000000100 dead000000000122 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5079, tgid 5079 (kworker/0:7), ts 77020787974, free_ts 77011459311 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1731 prep_new_page mm/page_alloc.c:1738 [inline] get_page_from_freelist+0x321c/0x33a0 mm/page_alloc.c:3502 __alloc_pages+0x255/0x670 mm/page_alloc.c:4768 alloc_slab_page+0x6a/0x160 mm/slub.c:1851 allocate_slab mm/slub.c:1998 [inline] new_slab+0x84/0x2f0 mm/slub.c:2051 ___slab_alloc+0xa85/0x10a0 mm/slub.c:3192 __slab_alloc mm/slub.c:3291 [inline] __slab_alloc_node mm/slub.c:3344 [inline] slab_alloc_node mm/slub.c:3441 [inline] __kmem_cache_alloc_node+0x1b8/0x290 mm/slub.c:3490 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc_node_track_caller+0xa5/0x230 mm/slab_common.c:986 kmalloc_reserve+0xfe/0x240 net/core/skbuff.c:585 __alloc_skb+0x1b1/0x420 net/core/skbuff.c:654 alloc_skb include/linux/skbuff.h:1288 [inline] alloc_skb_with_frags+0xa8/0x750 net/core/skbuff.c:6380 sock_alloc_send_pskb+0x919/0xa50 net/core/sock.c:2729 sock_alloc_send_skb include/net/sock.h:1872 [inline] mld_newpack+0x1c4/0xa90 net/ipv6/mcast.c:1748 add_grhead net/ipv6/mcast.c:1851 [inline] add_grec+0x148d/0x1990 net/ipv6/mcast.c:1989 mld_send_cr net/ipv6/mcast.c:2115 [inline] mld_ifc_work+0x68e/0xc90 net/ipv6/mcast.c:2653 process_one_work+0x8a0/0x10e0 kernel/workqueue.c:2405 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2564 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2659 discard_slab mm/slub.c:2097 [inline] __unfreeze_partials+0x1b1/0x1f0 mm/slub.c:2636 put_cpu_partial+0x116/0x180 mm/slub.c:2712 qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook+0x68/0x3a0 mm/slab.h:711 slab_alloc_node mm/slub.c:3451 [inline] kmem_cache_alloc_node+0x157/0x350 mm/slub.c:3496 __alloc_skb+0x181/0x420 net/core/skbuff.c:644 alloc_skb include/linux/skbuff.h:1288 [inline] nlmsg_new include/net/netlink.h:1003 [inline] rtmsg_ifinfo_build_skb+0x84/0x280 net/core/rtnetlink.c:4008 rtmsg_ifinfo_event net/core/rtnetlink.c:4051 [inline] rtmsg_ifinfo+0x91/0x1b0 net/core/rtnetlink.c:4060 netdev_state_change+0x1c8/0x250 net/core/dev.c:1319 linkwatch_do_dev+0x10c/0x160 net/core/link_watch.c:182 __linkwatch_run_queue+0x44c/0x6c0 net/core/link_watch.c:235 linkwatch_event+0x4c/0x60 net/core/link_watch.c:278 Memory state around the buggy address: ffff888076af0f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888076af0f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888076af1000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888076af1080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888076af1100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================