DragonFlyBSD Kernel Audit
DF-0926 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/vfs/fuse/fuse_node.c b/sys/vfs/fuse/fuse_node.c
--- a/sys/vfs/fuse/fuse_node.c
+++ b/sys/vfs/fuse/fuse_node.c
@@ -108,6 +108,14 @@ fuse_alloc_node(struct fuse_mount *fmp, struct fuse_node *dfnp,
 	if (fnp == NULL) {
 		fuse_node_new(fmp, ino, vtyp, &fnp);
 		allocated = 1;
+	} else if (fnp->type != vtyp) {
+		/*
+		 * The daemon returned an existing nodeid with a conflicting
+		 * type.  Reject instead of proceeding to fuse_set_attr which
+		 * would KKASSERT-panic the kernel (fuse_vnops.c:81).
+		 */
+		mtx_unlock(&fmp->ino_lock);
+		return EINVAL;
 	}
 	mtx_unlock(&fmp->ino_lock);