Skip to contentSkip to conversation

new_inode_autonum: fix up possible i_ino collision in simple_fill_super()

PATCH In review Jeff Layton 1 participant 1 message Nov 9, 2006 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 new_inode_autonum: fix up possible i_ino collision in simple_fill_super()

simple_fill_super() looked like a bug waiting to happen. It is fairly hard to trigger, but still. This should fix it, although in a fairly crude manner.

fs/libfs.c +4 -0
index bd08e0e..477c012 100644
@@ -373,6 +373,10 @@ int simple_fill_super(struct super_block
 	inode = new_inode(s);
 	if (!inode)
 		return -ENOMEM;
+	/* ino must not collide with any ino assigned in the loop below.
+	 * This value is arbitrary but should be "big enough" to avoid
+	 * collisions. */
+	inode->i_ino = 0x8000000;
 	inode->i_mode = S_IFDIR | 0755;
 	inode->i_uid = inode->i_gid = 0;
 	inode->i_blocks = 0;

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html