CVE-2026-138893: fault-inject: fix dentry leak
In the Linux kernel, the following vulnerability has been resolved:
fault-inject: fix dentry leak
faultcreatedebugfsattr() has always taken an extra dentry reference on the created directory (attr->dname = dget(dir)) so that faildump() could print the name via %pd from any context. Nothing anywhere in the tree ever calls dput() on attr->dname.
For callers with a matching teardown, that unmatched reference causes one dentry plus its attached inode to leak per faultcreatedebugfsattr / debugfsremoverecursive cycle. simplerecursiveremoval() drops debugfs's own +1 ref on the child dentry, but the dget()'d ref keeps its refcount at 1: the dentry ends up unhashed but pinned, and its inode is never freed.
Boot-once callers (mm/failslab, block/blk-core, etc.) leak exactly once at init and never destroy the tree, so the impact there is bounded. But per-lifecycle callers (drivers/nvme, drivers/infiniband/hw/hfi1, drivers/mmc, drivers/iommu/iommufd, drivers/media, drivers/misc, drivers/gpu/drm/msm, drivers/crypto, net/sunrpc) leak on every create/destroy cycle.
We observed this in production: an NVMe/RDMA host repeatedly reconnecting to a target that rejected the CRTO Property Get went through ~50 nvme controller create/destroy cycles per second, and dentry and inodecache grew by ~13k pinned objects per 240 s -- unrecoverable through dropcaches. Byte math matched a per-cycle 1-dentry / 1-inode leak from the "faultinject" directory dentry.
Fix this by not holding any external reference in faultattr. Embed the directory name as a fixed-size char array (FAULTATTRDNAMELEN, 64 bytes) inside struct faultattr, copied by strscpy() at faultcreatedebugfsattr() time. faildump() prints it via %s.
Advantages of an embedded array over kstrdup() + kfree() paired with a new destroy API:
- Zero API footprint. No new export and no caller changes required: callers already own their faultattr's memory and free it when they are done, and now that suffices. - No allocation on the create path. - faultcreatedebugfsattr() cannot fail from the name-copy step. - No lifetime coupling between attr->dname and debugfs; the string is valid for exactly as long as the containing struct.
The 64-byte length accommodates every in-tree caller with generous headroom (the longest current name is "faildmaarrayfull", 19 chars).
The user-visible faildump() format changes from "name %pd" to "name %s", but the printed content is identical -- %pd on the created directory renders the same string that was passed in as @name.
drivers/infiniband/hw/hfi1/fault.c drops a now-invalid "attr.dname = NULL" statement; the surrounding kzalloc() already zero-initialises the array.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In the Linux kernel fault-inject code, replace the external dentry reference in fault_attr with an embedded 64-byte directory-name array (FAULT_ATTR_DNAME_LEN), copy the name with strscpy(), and have fail_dump() print it with %s.
Event History
Frequently Asked Questions
Which systems are most likely to accumulate leaked kernel objects?
Systems that repeatedly create and destroy fault-injection debugfs trees are most exposed. The affected per-lifecycle callers include NVMe, HFI1 InfiniBand, MMC, IOMMUFD, media, misc, MSM DRM GPU, crypto, and SunRPC components.
Is the impact bounded for all callers?
No. Boot-once callers such as mm/failslab and block/blk-core leak once during initialization and do not destroy their trees, so their impact is bounded. Per-lifecycle callers leak one dentry and its attached inode for every create/destroy cycle.
How can an operator recognize this issue in practice?
Look for repeated lifecycle events involving affected components together with dentry and inode objects that remain allocated after debugfs tree removal. A reported production example involved an NVMe/RDMA host repeatedly reconnecting after a target rejected the CRTO Property Get request.