DragonFlyBSD Kernel Audit
DF-3064 / fix.diff
← back to finding ↓ download raw
--- sys/vfs/ext2fs/ext2_alloc.c
+++ sys/vfs/ext2fs/ext2_alloc.c
@@ -422,7 +422,8 @@
 restart:
-	if ((vp = ext2_ihashget(ump->um_dev, ino)) != NULL) {
-		printf("ext2_valloc: vp %p exists for inode %lu\n", vp, ino);
-		return (EEXIST);
-	}
+	if ((vp = ext2_ihashget(ump->um_dev, ino)) != NULL) {
+		printf("ext2_valloc: vp %p exists for inode %lu\n", vp, ino);
+		vput(vp);	/* DF-3064: release the vget()ed lock+ref */
+		return (EEXIST);
+	}
 	if (ext2_alloc_vnode(ump->um_mountp, ino, &vp) == -1)
 		goto restart;