WARNING in kernfs_put

Status: fixed on 2019/12/01 20:17
Fix commit: 5432923a6b20 driver core: Fix use-after-free and double free on glue directory
First crash: 1763d, last: 1696d
Fix bisection: fixed by (bisect log) :
commit 5432923a6b208b253d95d95cee72d0508c803421
Author: Muchun Song <>
Date: Sat Jul 27 03:21:22 2019 +0000

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

Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 WARNING in kernfs_put C done 1 1700d 1700d 1/1 fixed on 2019/12/01 20:17
upstream WARNING in kernfs_put kernfs C 4 1817d 1939d 0/26 closed as dup on 2018/10/31 16:05

Sample crash report:
kernfs_put: bluetooth/hci4: released with incorrect active_ref 0
------------[ cut here ]------------
kobject: 'rfkill686' (ffff888081b94668): kobject_uevent_env
WARNING: CPU: 1 PID: 7777 at fs/kernfs/dir.c:525 kernfs_put fs/kernfs/dir.c:525 [inline]
WARNING: CPU: 1 PID: 7777 at fs/kernfs/dir.c:525 kernfs_put.cold+0x8a/0xa4 fs/kernfs/dir.c:506
Kernel panic - not syncing: panic_on_warn set ...

CPU: 1 PID: 7777 Comm: syz-executor743 Not tainted 4.14.131 #25
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/0x19c 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:960
RIP: 0010:kernfs_put fs/kernfs/dir.c:525 [inline]
RIP: 0010:kernfs_put.cold+0x8a/0xa4 fs/kernfs/dir.c:506
RSP: 0018:ffff88809f537ae0 EFLAGS: 00010286
RAX: 0000000000000040 RBX: dffffc0000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff866d0ca0 RDI: ffffed1013ea6f52
RBP: ffff88809f537b38 R08: 0000000000000040 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff888083179380
R13: ffff888097871e00 R14: ffff8880831793b0 R15: ffffffff86fa8fe0
kobject: 'rfkill684' (ffff888081b94ee8): kobject_cleanup, parent           (null)
 sysfs_put include/linux/sysfs.h:549 [inline]
 kobject_del.part.0+0x42/0xf0 lib/kobject.c:576
 kobject_del+0x20/0x30 lib/kobject.c:571
 device_del+0x688/0xaa0 drivers/base/core.c:2023
 hci_unregister_dev+0x298/0x7d0 net/bluetooth/hci_core.c:3212
kobject: 'rfkill684' (ffff888081b94ee8): calling ktype release
 vhci_release+0x76/0xf0 drivers/bluetooth/hci_vhci.c:354
 __fput+0x275/0x7a0 fs/file_table.c:210
 ____fput+0x16/0x20 fs/file_table.c:244
 task_work_run+0x114/0x190 kernel/task_work.c:113
kobject: 'rfkill686' (ffff888081b94668): fill_kobj_path: path = '/devices/virtual/bluetooth/hci3/rfkill686'
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x7df/0x2c10 kernel/exit.c:874
 do_group_exit+0x111/0x330 kernel/exit.c:977
 SYSC_exit_group kernel/exit.c:988 [inline]
 SyS_exit_group+0x1d/0x20 kernel/exit.c:986
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
kobject: 'rfkill686' (ffff888081b94668): kobject_cleanup, parent           (null)
RIP: 0033:0x43fed8
RSP: 002b:00007fff79df6e28 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000043fed8
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004bf710 R08: 00000000000000e7 R09: ffffffffffffffd0
kobject: 'rfkill684': free name
R10: 0000000000000004 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d1180 R14: 0000000000000000 R15: 0000000000000000
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/06/30 23:16 linux-4.14.y f4cc0ed9b2c7 699d6448 .config console log report syz C ci2-linux-4-14
2019/04/25 05:09 linux-4.14.y 68d7a45eec10 8e3c52b1 .config console log report syz C ci2-linux-4-14
* Struck through repros no longer work on HEAD.