kobject_add_internal failed for hci2 (error: -2 parent: bluetooth) Bluetooth: Can't register HCI device kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#1] PREEMPT SMP KASAN kobject: 'rfkill17' (000000003f57d85b): kobject_uevent_env CPU: 1 PID: 7614 Comm: syz-executor643 Not tainted 5.0.0-rc6+ #68 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:kernfs_add_one+0x343/0x4d0 fs/kernfs/dir.c:812 kobject: 'hci2' (000000007a9c901f): calling ktype release Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 52 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 5b 70 48 8d 7b 08 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e 1f 01 00 00 8b 5b 08 31 ff 83 RSP: 0018:ffff8880a84c7848 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff87022ab8 RDX: 0000000000000001 RSI: ffffffff81d251db RDI: 0000000000000008 RBP: ffff8880a84c7888 R08: 1ffffffff1151204 R09: fffffbfff1151205 R10: fffffbfff1151204 R11: ffffffff88a89027 R12: ffff88809fd69b60 R13: ffff88809fd69b60 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8880ae900000(0063) knlGS:0000000008ba5840 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 kobject: 'rfkill17' (000000003f57d85b): fill_kobj_path: path = '/devices/virtual/bluetooth/hci3/rfkill17' CR2: 00000000200000c0 CR3: 0000000095381000 CR4: 00000000001406e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: kobject: 'hci2': free name kernfs_create_dir_ns+0xff/0x160 fs/kernfs/dir.c:1031 sysfs_create_dir_ns+0x131/0x2a0 fs/sysfs/dir.c:59 kobject: 'rfkill17' (000000003f57d85b): kobject_uevent_env create_dir lib/kobject.c:88 [inline] kobject_add_internal lib/kobject.c:247 [inline] kobject_add_internal.cold+0xe5/0x5d4 lib/kobject.c:217 kobject_add_varg lib/kobject.c:382 [inline] kobject_add+0x150/0x1c0 lib/kobject.c:426 kobject: 'rfkill17' (000000003f57d85b): fill_kobj_path: path = '/devices/virtual/bluetooth/hci3/rfkill17' kobject: 'rfkill17' (000000003f57d85b): kobject_cleanup, parent (null) device_add+0x3d5/0x1870 drivers/base/core.c:1912 hci_register_dev+0x304/0x880 net/bluetooth/hci_core.c:3261 kobject: 'hci5' (00000000f49e74fe): kobject_add_internal: parent: 'bluetooth', set: 'devices' __vhci_create_device+0x2d0/0x5a0 drivers/bluetooth/hci_vhci.c:139 vhci_create_device drivers/bluetooth/hci_vhci.c:163 [inline] vhci_get_user drivers/bluetooth/hci_vhci.c:219 [inline] vhci_write+0x2d0/0x470 drivers/bluetooth/hci_vhci.c:299 kobject: 'rfkill17' (000000003f57d85b): calling ktype release call_write_iter include/linux/fs.h:1863 [inline] new_sync_write fs/read_write.c:474 [inline] __vfs_write+0x613/0x8e0 fs/read_write.c:487 kobject: 'hci5' (00000000f49e74fe): kobject_uevent_env vfs_write+0x20c/0x580 fs/read_write.c:549 ksys_write+0xea/0x1f0 fs/read_write.c:598 kobject: 'rfkill18' (00000000f6e30442): kobject_add_internal: parent: 'hci2', set: 'devices' __do_sys_write fs/read_write.c:610 [inline] __se_sys_write fs/read_write.c:607 [inline] __ia32_sys_write+0x71/0xb0 fs/read_write.c:607 kobject: 'hci5' (00000000f49e74fe): fill_kobj_path: path = '/devices/virtual/bluetooth/hci5' do_syscall_32_irqs_on arch/x86/entry/common.c:326 [inline] do_fast_syscall_32+0x281/0xc98 arch/x86/entry/common.c:397 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 kobject: 'rfkill17': free name RIP: 0023:0xf7f40869 Code: 85 d2 74 02 89 0a 5b 5d c3 8b 04 24 c3 8b 14 24 c3 8b 3c 24 c3 90 90 90 90 90 90 90 90 90 90 90 90 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90 RSP: 002b:00000000ff9c579c EFLAGS: 00000246 ORIG_RAX: 0000000000000004 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000020000180 RDX: 0000000000000002 RSI: 0000000000000001 RDI: 00000000ff9c58d4 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 kobject: 'rfkill18' (00000000f6e30442): kobject_uevent_env Modules linked in: ---[ end trace c4ba62bda5b18881 ]--- kobject: 'rfkill18' (00000000f6e30442): fill_kobj_path: path = '/devices/virtual/bluetooth/hci2/rfkill18' RIP: 0010:kernfs_add_one+0x343/0x4d0 fs/kernfs/dir.c:812 kobject: 'hci3' (00000000d548b090): kobject_uevent_env Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 52 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 5b 70 48 8d 7b 08 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e 1f 01 00 00 8b 5b 08 31 ff 83 kobject: 'hci3' (00000000d548b090): fill_kobj_path: path = '/devices/virtual/bluetooth/hci3' RSP: 0018:ffff8880a84c7848 EFLAGS: 00010202 kobject: 'rfkill19' (00000000c7cad148): kobject_add_internal: parent: 'hci1', set: 'devices' RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff87022ab8 kobject: 'rfkill18' (00000000f6e30442): kobject_uevent_env RDX: 0000000000000001 RSI: ffffffff81d251db RDI: 0000000000000008 kobject: 'rfkill19' (00000000c7cad148): kobject_uevent_env RBP: ffff8880a84c7888 R08: 1ffffffff1151204 R09: fffffbfff1151205 kobject: 'rfkill19' (00000000c7cad148): fill_kobj_path: path = '/devices/virtual/bluetooth/hci1/rfkill19' kobject: 'hci3' (00000000d548b090): kobject_cleanup, parent (null) kobject: 'rfkill18' (00000000f6e30442): fill_kobj_path: path = '/devices/virtual/bluetooth/hci2/rfkill18' R10: fffffbfff1151204 R11: ffffffff88a89027 R12: ffff88809fd69b60 kobject: 'rfkill20' (00000000d273344e): kobject_add_internal: parent: 'hci4', set: 'devices' kobject: 'hci3' (00000000d548b090): calling ktype release kobject: 'rfkill19' (00000000c7cad148): kobject_uevent_env R13: ffff88809fd69b60 R14: 0000000000000000 R15: 0000000000000000 kobject: 'rfkill20' (00000000d273344e): kobject_uevent_env kobject: 'hci3': free name kobject: 'rfkill19' (00000000c7cad148): fill_kobj_path: path = '/devices/virtual/bluetooth/hci1/rfkill19' FS: 0000000000000000(0000) GS:ffff8880ae900000(0063) knlGS:0000000008ba5840 kobject: 'rfkill20' (00000000d273344e): fill_kobj_path: path = '/devices/virtual/bluetooth/hci4/rfkill20' CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 kobject: 'rfkill21' (00000000c6245b9b): kobject_add_internal: parent: 'hci5', set: 'devices' CR2: 00007f7fd30a3000 CR3: 0000000095381000 CR4: 00000000001406e0 kobject: 'rfkill20' (00000000d273344e): kobject_uevent_env DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 kobject: 'rfkill21' (00000000c6245b9b): kobject_uevent_env DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 kobject: 'hci3' (000000007dcbe024): kobject_add_internal: parent: 'bluetooth', set: 'devices'