git: 1e595e959f66 - main - devfs_open: do not access dsw after dev_relthread()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 06 Oct 2026 00:47:47 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=1e595e959f66e11d0490e90270b9fb701cbc6739
commit 1e595e959f66e11d0490e90270b9fb701cbc6739
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-05 23:35:32 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-10-06 00:30:49 +0000
devfs_open: do not access dsw after dev_relthread()
Noted and reviewed by: markj
Fixes: 850d4562928e ("cdevsw: add D_NONPASSABLE flag")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D60393
---
sys/fs/devfs/devfs_vnops.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index cd6cd1959d6b..53fb08c6931b 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -1288,6 +1288,7 @@ devfs_open(struct vop_open_args *ap)
int error, ref, vlocked;
struct cdevsw *dsw;
struct file *fpop;
+ bool passable;
if (vp->v_type == VBLK)
return (ENXIO);
@@ -1306,6 +1307,7 @@ devfs_open(struct vop_open_args *ap)
dev_relthread(dev, ref);
return (ENXIO);
}
+ passable = (dsw->d_flags & D_NONPASSABLE) == 0;
if (vp->v_type == VCHR)
devfs_usecount_add(vp);
@@ -1347,8 +1349,7 @@ devfs_open(struct vop_open_args *ap)
#endif
if (fp->f_ops == &badfileops) {
finit(fp, fp->f_flag, DTYPE_VNODE, dev,
- (dsw->d_flags & D_NONPASSABLE) == 0 ? &devfs_ops_f :
- &devfs_ops_nonpassable_f);
+ passable ? &devfs_ops_f : &devfs_ops_nonpassable_f);
}
return (error);
}