bisecting fixing commit since f6e27dbb1afabcba436e346d6aa88a592a1436bb building syzkaller on 2e29b534005e52c57d726201644ea28ba33a9a3d testing commit f6e27dbb1afabcba436e346d6aa88a592a1436bb with gcc (GCC) 8.1.0 kernel signature: f806f210d0a13eaccac98d0ba6101fdbddcbeb37 all runs: crashed: WARNING: refcount bug in cdev_get testing current HEAD e1f7d50ae3a3ec342e87a9b1ce6787bfb8b3c08b testing commit e1f7d50ae3a3ec342e87a9b1ce6787bfb8b3c08b with gcc (GCC) 8.1.0 kernel signature: 56576e498f8517c4603eef654eedc64769174199 all runs: crashed: WARNING: refcount bug in cdev_get revisions tested: 2, total time: 27m16.316506565s (build: 16m57.111644952s, test: 9m12.157093608s) the crash still happens on HEAD commit msg: Linux 4.14.160 crash: WARNING: refcount bug in cdev_get input: syz1 as /devices/virtual/input/input6926 input: syz1 as /devices/virtual/input/input6925 input: syz1 as /devices/virtual/input/input6927 refcount_t: increment on 0; use-after-free. ------------[ cut here ]------------ WARNING: CPU: 1 PID: 30572 at lib/refcount.c:153 refcount_inc.cold.12+0x13/0x1a lib/refcount.c:153 Kernel panic - not syncing: panic_on_warn set ... CPU: 1 PID: 30572 Comm: syz-executor.1 Not tainted 4.14.160-syzkaller #0 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+0xf7/0x13b lib/dump_stack.c:58 panic+0x1b0/0x358 kernel/panic.c:183 __warn.cold.8+0x25/0x2c kernel/panic.c:547 report_bug+0x1a4/0x1f3 lib/bug.c:186 fixup_bug arch/x86/kernel/traps.c:177 [inline] do_error_trap+0x1bd/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.cold.12+0x13/0x1a lib/refcount.c:153 RSP: 0018:ffff888094d47930 EFLAGS: 00010286 RAX: 000000000000002b RBX: ffff8880a1ab1368 RCX: 0000000000000000 RDX: 000000000000002b RSI: ffffffff868cf120 RDI: ffffed10129a8f1d RBP: ffff888094d47930 R08: ffff88807d28eca0 R09: 0000000000000000 R10: 0000000000000000 R11: dffffc0000000000 R12: 0000000000000000 R13: ffff8880a16c6630 R14: ffff888096d94340 R15: ffff8880a16c69b8 kref_get include/linux/kref.h:47 [inline] kobject_get+0x47/0x60 lib/kobject.c:596 cdev_get+0x46/0x80 fs/char_dev.c:364 chrdev_open+0x9c/0x5b0 fs/char_dev.c:409 do_dentry_open+0x620/0xdb0 fs/open.c:777 vfs_open+0xfc/0x240 fs/open.c:891 do_last fs/namei.c:3425 [inline] path_openat+0xe6d/0x3b50 fs/namei.c:3566 do_filp_open+0x16b/0x220 fs/namei.c:3600 do_sys_open+0x1c2/0x340 fs/open.c:1084 SYSC_open fs/open.c:1102 [inline] SyS_open+0x19/0x20 fs/open.c:1097 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x413911 RSP: 002b:00007f84bae9b7a0 EFLAGS: 00000293 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 6666666666666667 RCX: 0000000000413911 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007f84bae9b850 RBP: 000000000075bf20 R08: 000000000000000f R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000293 R12: 00007f84bae9c6d4 R13: 00000000004c9017 R14: 00000000004e04c8 R15: 00000000ffffffff Kernel Offset: disabled Rebooting in 86400 seconds..