DragonFlyBSD Kernel Audit
DF-0892 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/vfs/tmpfs/tmpfs_vfsops.c b/sys/vfs/tmpfs/tmpfs_vfsops.c
--- a/sys/vfs/tmpfs/tmpfs_vfsops.c
+++ b/sys/vfs/tmpfs/tmpfs_vfsops.c
@@ -423,8 +423,10 @@
 	} else {
 		error = tmpfs_alloc_vp(mp, NULL, tmp->tm_root,
 				       LK_EXCLUSIVE, vpp);
-		(*vpp)->v_flag |= VROOT;
-		(*vpp)->v_type = VDIR;
+		if (error == 0) {
+			(*vpp)->v_flag |= VROOT;
+			(*vpp)->v_type = VDIR;
+		}
 	}
 	return error;
 }