llcp: nfc_llcp_send_ui_frame: Could not allocate PDU (error=-6) ================================================================== BUG: KASAN: slab-use-after-free in nfc_alloc_send_skb+0x18c/0x190 net/nfc/core.c:722 Read of size 4 at addr ffff0000d985f560 by task syz-executor.0/6550 CPU: 1 PID: 6550 Comm: syz-executor.0 Not tainted 6.7.0-rc4-syzkaller-00020-gd46efae31672 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023 Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:233 show_stack+0x2c/0x44 arch/arm64/kernel/stacktrace.c:240 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0x174/0x514 mm/kasan/report.c:475 kasan_report+0xd8/0x138 mm/kasan/report.c:588 __asan_report_load4_noabort+0x20/0x2c mm/kasan/report_generic.c:380 nfc_alloc_send_skb+0x18c/0x190 net/nfc/core.c:722 nfc_llcp_send_ui_frame+0x22c/0x554 net/nfc/llcp_commands.c:766 llcp_sock_sendmsg+0x1f8/0x358 net/nfc/llcp_sock.c:809 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] ____sys_sendmsg+0x56c/0x840 net/socket.c:2584 ___sys_sendmsg net/socket.c:2638 [inline] __sys_sendmmsg+0x318/0x7d8 net/socket.c:2724 __do_sys_sendmmsg net/socket.c:2753 [inline] __se_sys_sendmmsg net/socket.c:2750 [inline] __arm64_sys_sendmmsg+0xa0/0xbc net/socket.c:2750 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155 el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595 Allocated by task 6550: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x7c mm/kasan/common.c:52 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:511 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:198 [inline] kmalloc_trace+0x70/0x88 mm/slab_common.c:1103 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:721 [inline] nfc_allocate_device+0x124/0x45c net/nfc/core.c:1065 nci_allocate_device+0x1ac/0x324 net/nfc/nci/core.c:1179 virtual_ncidev_open+0x84/0x1bc drivers/nfc/virtual_ncidev.c:141 misc_open+0x2f0/0x368 drivers/char/misc.c:165 chrdev_open+0x3c8/0x4dc fs/char_dev.c:414 do_dentry_open+0x778/0x12b4 fs/open.c:948 vfs_open+0x7c/0x90 fs/open.c:1082 do_open fs/namei.c:3622 [inline] path_openat+0x1f6c/0x2888 fs/namei.c:3779 do_filp_open+0x1bc/0x3cc fs/namei.c:3809 do_sys_openat2+0x124/0x1b8 fs/open.c:1440 do_sys_open fs/open.c:1455 [inline] __do_sys_openat fs/open.c:1471 [inline] __se_sys_openat fs/open.c:1466 [inline] __arm64_sys_openat+0x1f0/0x240 fs/open.c:1466 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155 el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595 Freed by task 6548: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x7c mm/kasan/common.c:52 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:522 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1800 [inline] slab_free_freelist_hook mm/slub.c:1826 [inline] slab_free mm/slub.c:3809 [inline] __kmem_cache_free+0x2ac/0x480 mm/slub.c:3822 kfree+0xb8/0x19c mm/slab_common.c:1056 nfc_release+0x1d4/0x27c net/nfc/core.c:980 device_release+0x8c/0x1ac kobject_cleanup lib/kobject.c:682 [inline] kobject_release lib/kobject.c:716 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1c4/0x3c4 lib/kobject.c:733 put_device+0x28/0x40 drivers/base/core.c:3733 nfc_free_device include/net/nfc/nfc.h:213 [inline] nci_free_device+0x40/0x60 net/nfc/nci/core.c:1209 virtual_ncidev_close+0x78/0xa0 drivers/nfc/virtual_ncidev.c:169 __fput+0x308/0x90c fs/file_table.c:394 __fput_sync+0x60/0x9c fs/file_table.c:475 __do_sys_close fs/open.c:1590 [inline] __se_sys_close fs/open.c:1575 [inline] __arm64_sys_close+0x150/0x1e0 fs/open.c:1575 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155 el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595 The buggy address belongs to the object at ffff0000d985f000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1376 bytes inside of freed 2048-byte region [ffff0000d985f000, ffff0000d985f800) The buggy address belongs to the physical page: page:00000000c1ab918c refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x119858 head:00000000c1ab918c order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x5ffc00000000840(slab|head|node=0|zone=2|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 05ffc00000000840 ffff0000c0002000 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000d985f400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000d985f480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000d985f500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000d985f580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000d985f600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================