Skip to contentSkip to conversation

Humfs directory creation bug.

uml-devel Piotr Neuman 2 participants 2 messages Jun 7, 2004 – Jul 1, 2004 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

Humfs code misreported device when getting stat info on directories. This code hopefully fixes that (mv will work with hardlinks as expected now).

Apply to 2.4.26-1 UML release (in arch/um/fs/hostfs/). Patch:

externfs.c +5 -1
Index: externfs.c
===================================================================
@@ -844,7 +844,6 @@
 		return(-ENOMEM);
 	err = (*ops->make_dir)(file, mode, current->fsuid, current->fsgid, 
 			       mount);
-	kfree(file);
 
 	inode = get_inode(ino->i_sb, dentry, ops, 1);
 	if(IS_ERR(inode)){
@@ -852,6 +851,11 @@
 		goto out;
 	}
 
+	err = read_name(inode, file);
+	kfree(file);
+	if(err)
+		goto out;
+
 	d_instantiate(dentry, inode);
 	inode->i_nlink = 2;
 	inode->i_mode = S_IFDIR | mode;
externfs.c +5 -1
Index: externfs.c
===================================================================
@@ -844,7 +844,6 @@
 		return(-ENOMEM);
 	err = (*ops->make_dir)(file, mode, current->fsuid, current->fsgid, 
 			       mount);
-	kfree(file);
 
 	inode = get_inode(ino->i_sb, dentry, ops, 1);
 	if(IS_ERR(inode)){
@@ -852,6 +851,11 @@
 		goto out;
 	}
 
+	err = read_name(inode, file);
+	kfree(file);
+	if(err)
+		goto out;
+
 	d_instantiate(dentry, inode);
 	inode->i_nlink = 2;
 	inode->i_mode = S_IFDIR | mode;
#1 lore raw
Quoted 4 lines · [email protected] said:

Humfs code misreported device when getting stat info on directories. This code hopefully fixes that (mv will work with hardlinks as expected now).
Apply to 2.4.26-1 UML release (in arch/um/fs/hostfs/). Patch:

Nice spotting.

However, you missed a kfree(file) along an error path.

Jeff

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel