summaryrefslogtreecommitdiffstats
path: root/sys/fs/devfs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/devfs')
-rw-r--r--sys/fs/devfs/devfs_devs.c10
-rw-r--r--sys/fs/devfs/devfs_vnops.c3
2 files changed, 13 insertions, 0 deletions
diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c
index e351ff8..c2d40d3 100644
--- a/sys/fs/devfs/devfs_devs.c
+++ b/sys/fs/devfs/devfs_devs.c
@@ -186,6 +186,16 @@ devfs_find(struct devfs_dirent *dd, const char *name, int namelen, int type)
continue;
if (type != 0 && type != de->de_dirent->d_type)
continue;
+
+ /*
+ * The race with finding non-active name is not
+ * completely closed by the check, but it is similar
+ * to the devfs_allocv() in making it unlikely enough.
+ */
+ if (de->de_dirent->d_type == DT_CHR &&
+ (de->de_cdp->cdp_flags & CDP_ACTIVE) == 0)
+ continue;
+
if (bcmp(name, de->de_dirent->d_name, namelen) != 0)
continue;
break;
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index 99ad355..d3ab235 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -1023,6 +1023,9 @@ devfs_mknod(struct vop_mknod_args *ap)
TAILQ_FOREACH(de, &dd->de_dlist, de_list) {
if (cnp->cn_namelen != de->de_dirent->d_namlen)
continue;
+ if (de->de_dirent->d_type == DT_CHR &&
+ (de->de_cdp->cdp_flags & CDP_ACTIVE) == 0)
+ continue;
if (bcmp(cnp->cn_nameptr, de->de_dirent->d_name,
de->de_dirent->d_namlen) != 0)
continue;
OpenPOWER on IntegriCloud