==================================================================
BUG: KASAN: use-after-free in nfc_llcp_find_local net/nfc/llcp_core.c:287 [inline]
BUG: KASAN: use-after-free in nfc_llcp_unregister_device+0x6c/0x11c net/nfc/llcp_core.c:1611
Read of size 8 at addr ffff0000d746c010 by task syz-executor.2/5636

CPU: 1 PID: 5636 Comm: syz-executor.2 Not tainted 6.2.0-syzkaller-18300-g2ebd1fbb946d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __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:306 [inline]
 print_report+0x174/0x4c0 mm/kasan/report.c:417
 kasan_report+0xd4/0x130 mm/kasan/report.c:517
 __asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351
 nfc_llcp_find_local net/nfc/llcp_core.c:287 [inline]
 nfc_llcp_unregister_device+0x6c/0x11c net/nfc/llcp_core.c:1611
 nfc_unregister_device+0x150/0x290 net/nfc/core.c:1179
 nci_unregister_device+0x1dc/0x21c net/nfc/nci/core.c:1303
 virtual_ncidev_close+0x5c/0xa0 drivers/nfc/virtual_ncidev.c:163
 __fput+0x30c/0x7bc fs/file_table.c:320
 ____fput+0x20/0x30 fs/file_table.c:348
 task_work_run+0x240/0x2f0 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 do_notify_resume+0x2180/0x3c90 arch/arm64/kernel/signal.c:1302
 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+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591

Allocated by task 5654:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:512
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 kmalloc_trace+0x7c/0x94 mm/slab_common.c:1067
 kmalloc include/linux/slab.h:580 [inline]
 kzalloc include/linux/slab.h:720 [inline]
 nfc_llcp_register_device+0x60/0x6bc net/nfc/llcp_core.c:1567
 nfc_register_device+0x8c/0x310 net/nfc/core.c:1124
 nci_register_device+0x6ac/0x7c4 net/nfc/nci/core.c:1257
 virtual_ncidev_open+0x13c/0x1bc drivers/nfc/virtual_ncidev.c:148
 misc_open+0x2f0/0x368 drivers/char/misc.c:165
 chrdev_open+0x3e8/0x4fc fs/char_dev.c:414
 do_dentry_open+0x734/0xfa0 fs/open.c:882
 vfs_open+0x7c/0x90 fs/open.c:1013
 do_open fs/namei.c:3557 [inline]
 path_openat+0x1d88/0x2578 fs/namei.c:3714
 do_filp_open+0x1bc/0x3cc fs/namei.c:3741
 do_sys_openat2+0x128/0x3d8 fs/open.c:1310
 do_sys_open fs/open.c:1326 [inline]
 __do_sys_openat fs/open.c:1342 [inline]
 __se_sys_openat fs/open.c:1337 [inline]
 __arm64_sys_openat+0x1f0/0x240 fs/open.c:1337
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x64/0x198 arch/arm64/kernel/syscall.c:193
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591

Freed by task 5648:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:523
 ____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:177 [inline]
 slab_free_hook mm/slub.c:1781 [inline]
 slab_free_freelist_hook mm/slub.c:1807 [inline]
 slab_free mm/slub.c:3787 [inline]
 __kmem_cache_free+0x2c0/0x4b4 mm/slub.c:3800
 kfree+0xfc/0x220 mm/slab_common.c:1020
 local_release net/nfc/llcp_core.c:174 [inline]
 kref_put include/linux/kref.h:65 [inline]
 nfc_llcp_local_put+0x15c/0x1b4 net/nfc/llcp_core.c:182
 nfc_llcp_unregister_device+0xa4/0x11c net/nfc/llcp_core.c:1620
 nfc_unregister_device+0x150/0x290 net/nfc/core.c:1179
 nci_unregister_device+0x1dc/0x21c net/nfc/nci/core.c:1303
 virtual_ncidev_close+0x5c/0xa0 drivers/nfc/virtual_ncidev.c:163
 __fput+0x30c/0x7bc fs/file_table.c:320
 ____fput+0x20/0x30 fs/file_table.c:348
 task_work_run+0x240/0x2f0 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 do_notify_resume+0x2180/0x3c90 arch/arm64/kernel/signal.c:1302
 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+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
 el0t_64_sync_handler+0x84/0xf0 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+0x40/0x70 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:493
 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:503
 __call_rcu_common kernel/rcu/tree.c:2755 [inline]
 call_rcu+0x104/0xb38 kernel/rcu/tree.c:2868
 netlink_release+0x1218/0x16d4 net/netlink/af_netlink.c:828
 __sock_release net/socket.c:650 [inline]
 sock_close+0xb8/0x1fc net/socket.c:1368
 __fput+0x30c/0x7bc fs/file_table.c:320
 ____fput+0x20/0x30 fs/file_table.c:348
 task_work_run+0x240/0x2f0 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 do_notify_resume+0x2180/0x3c90 arch/arm64/kernel/signal.c:1302
 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+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
 el0t_64_sync_handler+0x84/0xf0 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+0x40/0x70 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:493
 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:503
 __call_rcu_common kernel/rcu/tree.c:2755 [inline]
 call_rcu+0x104/0xb38 kernel/rcu/tree.c:2868
 netlink_release+0x1218/0x16d4 net/netlink/af_netlink.c:828
 __sock_release net/socket.c:650 [inline]
 sock_close+0xb8/0x1fc net/socket.c:1368
 __fput+0x30c/0x7bc fs/file_table.c:320
 ____fput+0x20/0x30 fs/file_table.c:348
 task_work_run+0x240/0x2f0 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 do_notify_resume+0x2180/0x3c90 arch/arm64/kernel/signal.c:1302
 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+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
 el0t_64_sync_handler+0x84/0xf0 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 ffff0000d746c000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 16 bytes inside of
 2048-byte region [ffff0000d746c000, ffff0000d746c800)

The buggy address belongs to the physical page:
page:00000000a439b096 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x117468
head:00000000a439b096 order:3 compound_mapcount:0 subpages_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 ffff0000c0002900 fffffc00031eb000 dead000000000002
raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000d746bf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000d746bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000d746c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff0000d746c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d746c100: 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: 5636 Comm: syz-executor.2 Tainted: G    B              6.2.0-syzkaller-18300-g2ebd1fbb946d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : nfc_llcp_find_local net/nfc/llcp_core.c:287 [inline]
pc : nfc_llcp_unregister_device+0x5c/0x11c net/nfc/llcp_core.c:1611
lr : nfc_llcp_unregister_device+0x48/0x11c net/nfc/llcp_core.c:1611
sp : ffff80001e377810
x29: ffff80001e377810 x28: 1fffe000197e640f x27: 1fffe000197e6405
x26: ffff0000cbf32028 x25: ffff0000cc0a1410 x24: 1fffe0001a4b76c1
x23: ffff80001850ef40 x22: dfff800000000000 x21: 0000000000000010
x20: ffff0000d25bb000 x19: 0000000000000000 x18: 1fffe0003689f976
x17: 0000000000000000 x16: ffff800008973320 x15: 0000000000000000
x14: 0000000000000000 x13: fffffffffffc2318 x12: 0000000000000001
x11: ff8080001211f0e4 x10: 0000000000000000 x9 : ffff800019cd3450
x8 : 0000000000000002 x7 : fffffffffffc2318 x6 : fffffffffffc22e8
x5 : ffff80001e377018 x4 : ffff800015c453a8 x3 : ffff80001211f0b0
x2 : 0000000000000000 x1 : 0000000000000008 x0 : 0000000000000000
Call trace:
 nfc_llcp_find_local net/nfc/llcp_core.c:287 [inline]
 nfc_llcp_unregister_device+0x5c/0x11c net/nfc/llcp_core.c:1611
 nfc_unregister_device+0x150/0x290 net/nfc/core.c:1179
 nci_unregister_device+0x1dc/0x21c net/nfc/nci/core.c:1303
 virtual_ncidev_close+0x5c/0xa0 drivers/nfc/virtual_ncidev.c:163
 __fput+0x30c/0x7bc fs/file_table.c:320
 ____fput+0x20/0x30 fs/file_table.c:348
 task_work_run+0x240/0x2f0 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 do_notify_resume+0x2180/0x3c90 arch/arm64/kernel/signal.c:1302
 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+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591
Code: eb17027f 54000180 91004275 d343fea8 (38766908) 
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
   0:	eb17027f 	cmp	x19, x23
   4:	54000180 	b.eq	0x34  // b.none
   8:	91004275 	add	x21, x19, #0x10
   c:	d343fea8 	lsr	x8, x21, #3
* 10:	38766908 	ldrb	w8, [x8, x22] <-- trapping instruction