DragonFlyBSD Kernel Audit
← triage · dashboard
DF-3021

devfs_fo_stat dereferences DEVFS_NODE(vp)->d_dev without the NULL guard getattr has → NULL-deref panic when the device node was torn down under an open fd

Field Value
ID DF-3021
Status new
Severity Low
CVSS 3.1 CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H
CWE CWE-476
File sys/vfs/devfs/devfs_vnops.c
Lines 1432 (guard contrast :565)
Area vfs/devfs
Confidence likely
Discovered 2026-09-02
Pass 2 (GLM 5.3 second pass)
Bucket memcorrupt
Reported pending
Known CVE none
CVE match novel

Summary

devfs_vop_getattr guards 'if (node == NULL) return EIO' because devfs_freep NULLs vp->v_data on device destruction; devfs_fo_stat calls vn_stat (→getattr, guarded) and then unconditionally does sb->st_rdev = devid_from_dev(DEVFS_NODE(vp)->d_dev) at :1432 — a detach racing between the getattr and :1432 NULL-derefs. Needs a device destroyed while an fd is open (revoke/driver detach — root-mediated; pty protocol blocks the unpriv variant), then fstat(fd) races the detach → panic. Not executed (root pre-condition); direct code-path. Fix: cache node once at fo_stat entry and guard, or take the vp lock around the stat critical section.

Timeline

  • 2026-09-02 Discovered during pass-2 audit of devfs_vnops.c (GLM 5.3).

Discussion (0)

No comments yet.