==================================================================
BUG: KASAN: slab-use-after-free in __list_add_valid_or_report+0xed/0x100 lib/list_debug.c:29
Read of size 8 at addr ffff88801faf1008 by task syz-executor.1/26272
CPU: 1 PID: 26272 Comm: syz-executor.1 Not tainted 6.6.0-rc2-syzkaller-00018-g2cf0f7156238 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023
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_add_valid_or_report+0xed/0x100 lib/list_debug.c:29
__list_add_valid include/linux/list.h:88 [inline]
__list_add include/linux/list.h:150 [inline]
list_add include/linux/list.h:169 [inline]
nfc_llcp_register_device+0x7a3/0x9d0 net/nfc/llcp_core.c:1639
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
RIP: 0033:0x7f84ed87cae9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f84ee5810c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f84ed99c050 RCX: 00007f84ed87cae9
RDX: 0000000000000002 RSI: 0000000020004dc0 RDI: ffffffffffffff9c
RBP: 00007f84ed8c847a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000006e R14: 00007f84ed99c050 R15: 00007fff717cfe58
Allocated by task 26265:
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+0xa2/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 26264:
kasan_save_stack+0x33/0x50 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:522
____kasan_slab_free mm/kasan/common.c:236 [inline]
____kasan_slab_free+0x15b/0x1b0 mm/kasan/common.c:200
kasan_slab_free include/linux/kasan.h:164 [inline]
slab_free_hook mm/slub.c:1800 [inline]
slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826
slab_free mm/slub.c:3809 [inline]
__kmem_cache_free+0xb8/0x2f0 mm/slub.c:3822
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+0xbc/0xd0 mm/kasan/generic.c:492
insert_work+0x38/0x230 kernel/workqueue.c:1647
__queue_work+0x5d0/0x1050 kernel/workqueue.c:1799
queue_work_on+0xed/0x110 kernel/workqueue.c:1834
queue_work include/linux/workqueue.h:554 [inline]
schedule_work include/linux/workqueue.h:615 [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
Second to last potentially related work creation:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
__kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492
insert_work+0x38/0x230 kernel/workqueue.c:1647
__queue_work+0x5d0/0x1050 kernel/workqueue.c:1799
queue_work_on+0xed/0x110 kernel/workqueue.c:1834
queue_work include/linux/workqueue.h:554 [inline]
schedule_work include/linux/workqueue.h:615 [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 ffff88801faf1000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 8 bytes inside of
freed 2048-byte region [ffff88801faf1000, ffff88801faf1800)
The buggy address belongs to the physical page:
page:ffffea00007ebc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1faf0
head:ffffea00007ebc00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888012c42000 ffffea0000a57800 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5061, tgid 5061 (syz-executor.4), ts 61893553403, free_ts 61838107666
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+0xee0/0x2f20 mm/page_alloc.c:3170
__alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426
alloc_pages+0x1a9/0x270 mm/mempolicy.c:2298
alloc_slab_page mm/slub.c:1870 [inline]
allocate_slab+0x251/0x380 mm/slub.c:2017
new_slab mm/slub.c:2070 [inline]
___slab_alloc+0x8c7/0x1580 mm/slub.c:3223
__slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322
__slab_alloc_node mm/slub.c:3375 [inline]
slab_alloc_node mm/slub.c:3468 [inline]
__kmem_cache_alloc_node+0x131/0x340 mm/slub.c:3517
__do_kmalloc_node mm/slab_common.c:1022 [inline]
__kmalloc_node+0x52/0x110 mm/slab_common.c:1030
kmalloc_node include/linux/slab.h:619 [inline]
kvmalloc_node+0x99/0x1a0 mm/util.c:607
kvmalloc include/linux/slab.h:737 [inline]
kvmalloc_array include/linux/slab.h:755 [inline]
__alloc_bucket_spinlocks+0x61/0x160 lib/bucket_locks.c:34
alloc_ila_locks net/ipv6/ila/ila_xlat.c:29 [inline]
ila_xlat_init_net+0x81/0x110 net/ipv6/ila/ila_xlat.c:609
ops_init+0xb9/0x650 net/core/net_namespace.c:136
setup_net+0x422/0xa40 net/core/net_namespace.c:339
copy_net_ns+0x2fa/0x670 net/core/net_namespace.c:491
create_new_namespaces+0x3ea/0xb10 kernel/nsproxy.c:110
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
__unfreeze_partials+0x21d/0x240 mm/slub.c:2655
qlink_free mm/kasan/quarantine.c:166 [inline]
qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185
kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:292
__kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:188 [inline]
slab_post_alloc_hook mm/slab.h:762 [inline]
slab_alloc_node mm/slub.c:3478 [inline]
__kmem_cache_alloc_node+0x195/0x340 mm/slub.c:3517
__do_kmalloc_node mm/slab_common.c:1022 [inline]
__kmalloc+0x4f/0x100 mm/slab_common.c:1036
kmalloc include/linux/slab.h:603 [inline]
tomoyo_add_entry security/tomoyo/common.c:2023 [inline]
tomoyo_supervisor+0xcdb/0xea0 security/tomoyo/common.c:2095
tomoyo_audit_path_number_log security/tomoyo/file.c:235 [inline]
tomoyo_path_number_perm+0x43d/0x580 security/tomoyo/file.c:734
security_file_ioctl+0x72/0xb0 security/security.c:2647
__do_sys_ioctl fs/ioctl.c:865 [inline]
__se_sys_ioctl fs/ioctl.c:857 [inline]
__x64_sys_ioctl+0xbb/0x210 fs/ioctl.c:857
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:
ffff88801faf0f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88801faf0f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88801faf1000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88801faf1080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801faf1100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
list_add corruption. next->prev should be prev (ffffffff8eae2a20), but was 04b401f800006698. (next=ffff88801faf1000).
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:29!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 26272 Comm: syz-executor.1 Tainted: G B 6.6.0-rc2-syzkaller-00018-g2cf0f7156238 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023
RIP: 0010:__list_add_valid_or_report+0xa2/0x100 lib/list_debug.c:29
Code: c7 c7 60 2c e9 8a e8 ed 79 3f fd 0f 0b 48 c7 c7 00 2d e9 8a e8 df 79 3f fd 0f 0b 48 89 d9 48 c7 c7 60 2d e9 8a e8 ce 79 3f fd <0f> 0b 48 89 f1 48 c7 c7 e0 2d e9 8a 48 89 de e8 ba 79 3f fd 0f 0b
RSP: 0018:ffffc90005017820 EFLAGS: 00010286
RAX: 0000000000000075 RBX: ffff88801faf1000 RCX: ffffc9000a1d2000
RDX: 0000000000000000 RSI: ffffffff816b8562 RDI: 0000000000000005
RBP: ffff8880295e6000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000080000000 R11: 0000000000000001 R12: ffff8880295e6008
R13: ffff88801faf1000 R14: ffff88801faf30f0 R15: ffff88801faf3140
FS: 00007f84ee5816c0(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555555ea88f8 CR3: 000000001c54f000 CR4: 0000000000350ee0
Call Trace:
__list_add_valid include/linux/list.h:88 [inline]
__list_add include/linux/list.h:150 [inline]
list_add include/linux/list.h:169 [inline]
nfc_llcp_register_device+0x7a3/0x9d0 net/nfc/llcp_core.c:1639
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
RIP: 0033:0x7f84ed87cae9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f84ee5810c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f84ed99c050 RCX: 00007f84ed87cae9
RDX: 0000000000000002 RSI: 0000000020004dc0 RDI: ffffffffffffff9c
RBP: 00007f84ed8c847a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000006e R14: 00007f84ed99c050 R15: 00007fff717cfe58
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__list_add_valid_or_report+0xa2/0x100 lib/list_debug.c:29
Code: c7 c7 60 2c e9 8a e8 ed 79 3f fd 0f 0b 48 c7 c7 00 2d e9 8a e8 df 79 3f fd 0f 0b 48 89 d9 48 c7 c7 60 2d e9 8a e8 ce 79 3f fd <0f> 0b 48 89 f1 48 c7 c7 e0 2d e9 8a 48 89 de e8 ba 79 3f fd 0f 0b
RSP: 0018:ffffc90005017820 EFLAGS: 00010286
RAX: 0000000000000075 RBX: ffff88801faf1000 RCX: ffffc9000a1d2000
RDX: 0000000000000000 RSI: ffffffff816b8562 RDI: 0000000000000005
RBP: ffff8880295e6000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000080000000 R11: 0000000000000001 R12: ffff8880295e6008
R13: ffff88801faf1000 R14: ffff88801faf30f0 R15: ffff88801faf3140
FS: 00007f84ee5816c0(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2ee2a000 CR3: 000000001c54f000 CR4: 0000000000350ee0