syzbot


WARNING: refcount bug in hci_register_dev

Status: fixed on 2019/12/05 10:31
Reported-by: syzbot+ab6feb304a8dd6b6185d@syzkaller.appspotmail.com
Fix commit: 5432923a6b20 driver core: Fix use-after-free and double free on glue directory
First crash: 1270d, last: 1255d

Fix bisection: fixed by (bisect log) :
commit 5432923a6b208b253d95d95cee72d0508c803421
Author: Muchun Song <smuchun@gmail.com>
Date: Sat Jul 27 03:21:22 2019 +0000

  driver core: Fix use-after-free and double free on glue directory

similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 WARNING: refcount bug in hci_register_dev C done 3 1243d 1255d 1/1 fixed on 2019/12/05 23:59

Sample crash report:
refcount_t: increment on 0; use-after-free.
------------[ cut here ]------------
WARNING: CPU: 0 PID: 7669 at lib/refcount.c:153 refcount_inc lib/refcount.c:153 [inline]
WARNING: CPU: 0 PID: 7669 at lib/refcount.c:153 refcount_inc.cold+0x18/0x1f lib/refcount.c:151
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 7669 Comm: syz-executor276 Not tainted 4.14.141 #37
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x138/0x197 lib/dump_stack.c:53
 panic+0x1f2/0x426 kernel/panic.c:182
 __warn.cold+0x2f/0x36 kernel/panic.c:546
 report_bug+0x216/0x254 lib/bug.c:186
 fixup_bug arch/x86/kernel/traps.c:177 [inline]
 fixup_bug arch/x86/kernel/traps.c:172 [inline]
 do_error_trap+0x1bb/0x310 arch/x86/kernel/traps.c:295
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:314
 invalid_op+0x1b/0x40 arch/x86/entry/entry_64.S:963
RIP: 0010:refcount_inc lib/refcount.c:153 [inline]
RIP: 0010:refcount_inc.cold+0x18/0x1f lib/refcount.c:151
RSP: 0018:ffff8880918379c0 EFLAGS: 00010286
RAX: 000000000000002b RBX: ffffffff86faca20 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff866d10e0 RDI: ffffed1012306f2e
RBP: ffff8880918379c8 R08: 000000000000002b R09: ffff88808205cd88
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8880a7d819b8
R13: 0000000000000000 R14: ffff8880a7d81980 R15: ffff8880939edea0
 kref_get include/linux/kref.h:47 [inline]
 kobject_get+0x5b/0x70 lib/kobject.c:596
 kset_get include/linux/kobject.h:210 [inline]
 kobj_kset_join lib/kobject.c:169 [inline]
 kobject_add_internal.part.0+0xfc/0x340 lib/kobject.c:220
 kobject_add_internal lib/kobject.c:205 [inline]
 kobject_add_varg lib/kobject.c:364 [inline]
 kobject_add+0x11f/0x180 lib/kobject.c:409
 class_dir_create_and_add drivers/base/core.c:1484 [inline]
 get_device_parent.isra.0+0x415/0x560 drivers/base/core.c:1539
 device_add+0x2d3/0x1490 drivers/base/core.c:1795
 hci_register_dev+0x2d9/0x810 net/bluetooth/hci_core.c:3118
 __vhci_create_device+0x2a6/0x560 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+0x2a1/0x437 drivers/bluetooth/hci_vhci.c:299
 call_write_iter include/linux/fs.h:1777 [inline]
 new_sync_write fs/read_write.c:469 [inline]
 __vfs_write+0x4a7/0x6b0 fs/read_write.c:482
 vfs_write+0x198/0x500 fs/read_write.c:544
 SYSC_write fs/read_write.c:590 [inline]
 SyS_write+0xfd/0x230 fs/read_write.c:582
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x441279
RSP: 002b:00007ffd27273b48 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441279
RDX: 0000000000000002 RSI: 0000000020000180 RDI: 0000000000000003
RBP: 0000000000078fd7 R08: 00000000004002c8 R09: 00000000004002c8
R10: 0000000000000004 R11: 0000000000000246 R12: 0000000000401ff0
R13: 0000000000402080 R14: 0000000000000000 R15: 0000000000000000
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (3):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci2-linux-4-14 2019/08/31 21:47 linux-4.14.y 01fd1694b93c bad3cce2 .config console log report syz C
ci2-linux-4-14 2019/08/25 16:25 linux-4.14.y b5260801526c d21c5d9d .config console log report syz C
ci2-linux-4-14 2019/08/17 08:37 linux-4.14.y 45f092f9e9cb 8fd428a1 .config console log report syz C
* Struck through repros no longer work on HEAD.