================================================================== BUG: KASAN: slab-use-after-free in nfc_llcp_find_local+0xf0/0xf4 net/nfc/llcp_core.c:286 Read of size 8 at addr ffff000017dea000 by task syz-executor.1/7116 CPU: 0 PID: 7116 Comm: syz-executor.1 Not tainted 6.4.0-rc2-syzkaller-00238-gcbd6ac3837cd #0 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x9c/0x11c arch/arm64/kernel/stacktrace.c:233 show_stack+0x18/0x24 arch/arm64/kernel/stacktrace.c:240 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x74/0xd4 lib/dump_stack.c:106 print_address_description.constprop.0+0x58/0x39c mm/kasan/report.c:351 print_report mm/kasan/report.c:462 [inline] kasan_report+0x10c/0x138 mm/kasan/report.c:572 __asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381 nfc_llcp_find_local+0xf0/0xf4 net/nfc/llcp_core.c:286 nfc_llcp_unregister_device+0x10/0x20c net/nfc/llcp_core.c:1611 nfc_unregister_device+0x120/0x298 net/nfc/core.c:1179 nci_unregister_device+0x1c0/0x280 net/nfc/nci/core.c:1303 virtual_ncidev_close+0x48/0xb0 drivers/nfc/virtual_ncidev.c:163 __fput+0x1ac/0x860 fs/file_table.c:321 ____fput+0x10/0x1c fs/file_table.c:349 task_work_run+0x124/0x20c kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] do_notify_resume+0x908/0x26b4 arch/arm64/kernel/signal.c:1304 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline] el0_svc+0x10c/0x130 arch/arm64/kernel/entry-common.c:638 el0t_64_sync_handler+0xb8/0xbc arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 Allocated by task 7125: kasan_save_stack+0x2c/0x54 mm/kasan/common.c:45 kasan_set_track+0x2c/0x40 mm/kasan/common.c:52 kasan_save_alloc_info+0x24/0x34 mm/kasan/generic.c:510 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa0/0xb8 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:196 [inline] kmalloc_trace+0x74/0x88 mm/slab_common.c:1062 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [inline] nfc_llcp_register_device+0x44/0x7e4 net/nfc/llcp_core.c:1567 nfc_register_device+0x78/0x320 net/nfc/core.c:1124 nci_register_device+0x604/0x8c0 net/nfc/nci/core.c:1257 virtual_ncidev_open+0x110/0x1d4 drivers/nfc/virtual_ncidev.c:148 misc_open+0x294/0x394 drivers/char/misc.c:165 chrdev_open+0x1c0/0x544 fs/char_dev.c:414 do_dentry_open+0x3c4/0xf38 fs/open.c:920 vfs_open+0x90/0xc8 fs/open.c:1051 do_open fs/namei.c:3636 [inline] path_openat+0x102c/0x1ef8 fs/namei.c:3791 do_filp_open+0x154/0x328 fs/namei.c:3818 do_sys_openat2+0x124/0x394 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] __arm64_sys_openat+0x130/0x1bc fs/open.c:1383 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x6c/0x260 arch/arm64/kernel/syscall.c:52 el0_svc_common.constprop.0+0xc4/0x254 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x50/0x124 arch/arm64/kernel/syscall.c:193 el0_svc+0x4c/0x130 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0xb8/0xbc arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 Freed by task 7124: kasan_save_stack+0x2c/0x54 mm/kasan/common.c:45 kasan_set_track+0x2c/0x40 mm/kasan/common.c:52 kasan_save_free_info+0x38/0x60 mm/kasan/generic.c:521 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x120/0x1b8 mm/kasan/common.c:200 __kasan_slab_free+0x18/0x24 mm/kasan/common.c:244 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+0xac/0x3cc mm/slub.c:3799 kfree+0xbc/0x1b0 mm/slab_common.c:1015 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+0x15c/0x20c net/nfc/llcp_core.c:1620 nfc_unregister_device+0x120/0x298 net/nfc/core.c:1179 nci_unregister_device+0x1c0/0x280 net/nfc/nci/core.c:1303 virtual_ncidev_close+0x48/0xb0 drivers/nfc/virtual_ncidev.c:163 __fput+0x1ac/0x860 fs/file_table.c:321 ____fput+0x10/0x1c fs/file_table.c:349 task_work_run+0x124/0x20c kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] do_notify_resume+0x908/0x26b4 arch/arm64/kernel/signal.c:1304 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline] el0_svc+0x10c/0x130 arch/arm64/kernel/entry-common.c:638 el0t_64_sync_handler+0xb8/0xbc arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 Last potentially related work creation: kasan_save_stack+0x2c/0x54 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb8/0xe8 mm/kasan/generic.c:491 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:501 __call_rcu_common.constprop.0+0x9c/0x920 kernel/rcu/tree.c:2627 call_rcu+0x10/0x1c kernel/rcu/tree.c:2741 netlink_release+0x938/0x1400 net/netlink/af_netlink.c:828 __sock_release+0xa0/0x210 net/socket.c:653 sock_close+0x18/0x28 net/socket.c:1397 __fput+0x1ac/0x860 fs/file_table.c:321 ____fput+0x10/0x1c fs/file_table.c:349 task_work_run+0x124/0x20c kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] do_notify_resume+0x908/0x26b4 arch/arm64/kernel/signal.c:1304 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline] el0_svc+0x10c/0x130 arch/arm64/kernel/entry-common.c:638 el0t_64_sync_handler+0xb8/0xbc arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 Second to last potentially related work creation: kasan_save_stack+0x2c/0x54 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb8/0xe8 mm/kasan/generic.c:491 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:501 __call_rcu_common.constprop.0+0x9c/0x920 kernel/rcu/tree.c:2627 call_rcu+0x10/0x1c kernel/rcu/tree.c:2741 netlink_release+0x938/0x1400 net/netlink/af_netlink.c:828 __sock_release+0xa0/0x210 net/socket.c:653 sock_close+0x18/0x28 net/socket.c:1397 __fput+0x1ac/0x860 fs/file_table.c:321 ____fput+0x10/0x1c fs/file_table.c:349 task_work_run+0x124/0x20c kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] do_notify_resume+0x908/0x26b4 arch/arm64/kernel/signal.c:1304 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline] el0_svc+0x10c/0x130 arch/arm64/kernel/entry-common.c:638 el0t_64_sync_handler+0xb8/0xbc arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 The buggy address belongs to the object at ffff000017dea000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 0 bytes inside of freed 2048-byte region [ffff000017dea000, ffff000017dea800) The buggy address belongs to the physical page: page:0000000022b9be1e refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x57de8 head:0000000022b9be1e order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x1ffc00000010200(slab|head|node=0|zone=0|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 01ffc00000010200 ffff000009802900 fffffc0000507a00 dead000000000002 raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff000017de9f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff000017de9f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff000017dea000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff000017dea080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff000017dea100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== Unable to handle kernel paging request at virtual address dfff800000000002 KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017] Mem abort info: ESR = 0x0000000096000006 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x06: level 2 translation fault Data abort info: ISV = 0, ISS = 0x00000006 CM = 0, WnR = 0 [dfff800000000002] address between user and kernel address ranges Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP Modules linked in: CPU: 1 PID: 7116 Comm: syz-executor.1 Tainted: G B 6.4.0-rc2-syzkaller-00238-gcbd6ac3837cd #0 Hardware name: linux,dummy-virt (DT) pstate: 00000005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : nfc_llcp_find_local+0x54/0xf4 net/nfc/llcp_core.c:287 lr : nfc_llcp_find_local+0xf0/0xf4 net/nfc/llcp_core.c:286 sp : ffff800013c77970 x29: ffff800013c77970 x28: ffff00000f3c3d60 x27: ffff00001655b0a0 x26: ffff0000170ed038 x25: 1fffe00002e1da07 x24: 1fffe00002e54ca4 x23: ffff0000170e8600 x22: ffff0000170e8000 x21: ffff80000f7bc2c0 x20: dfff800000000000 x19: 0000000000000000 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 x14: 0000000000000000 x13: 205d363131375420 x12: ffff700001f24ee9 x11: 1ffff00001f24ee8 x10: ffff700001f24ee8 x9 : dfff800000000000 x8 : ffff80000f927747 x7 : 00008ffffe0db118 x6 : 0000000000000001 x5 : ffff80000f927740 x4 : 0000000000000000 x3 : 0000000000000000 x2 : 0000000000000002 x1 : ffff800010d35a48 x0 : 0000000000000010 Call trace: nfc_llcp_find_local+0x54/0xf4 net/nfc/llcp_core.c:287 nfc_llcp_unregister_device+0x10/0x20c net/nfc/llcp_core.c:1611 nfc_unregister_device+0x120/0x298 net/nfc/core.c:1179 nci_unregister_device+0x1c0/0x280 net/nfc/nci/core.c:1303 virtual_ncidev_close+0x48/0xb0 drivers/nfc/virtual_ncidev.c:163 __fput+0x1ac/0x860 fs/file_table.c:321 ____fput+0x10/0x1c fs/file_table.c:349 task_work_run+0x124/0x20c kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] do_notify_resume+0x908/0x26b4 arch/arm64/kernel/signal.c:1304 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline] el0_svc+0x10c/0x130 arch/arm64/kernel/entry-common.c:638 el0t_64_sync_handler+0xb8/0xbc arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 Code: eb15027f 540001e0 91004260 d343fc02 (38f46842) ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess): 0: eb15027f cmp x19, x21 4: 540001e0 b.eq 0x40 // b.none 8: 91004260 add x0, x19, #0x10 c: d343fc02 lsr x2, x0, #3 * 10: 38f46842 ldrsb w2, [x2, x20] <-- trapping instruction