Skip to contentSkip to conversation

ext2 fix

PATCH [email protected] 1 participant 1 message Aug 22, 2006 ext2 file system

lore
Share & tools
lore
#0 lore raw

Mounting an ext2 filesystem with zero s_inodes_per_group will cause a divide error. Below a patch against 2.6.17.8.

Andries

fs/ext2/super.c +1 -1
diff -uprN -X /linux/dontdiff a/fs/ext2/super.c b/fs/ext2/super.c
@@ -776,7 +776,7 @@ static int ext2_fill_super(struct super_
 	if (EXT2_INODE_SIZE(sb) == 0)
 		goto cantfind_ext2;
 	sbi->s_inodes_per_block = sb->s_blocksize / EXT2_INODE_SIZE(sb);
-	if (sbi->s_inodes_per_block == 0)
+	if (sbi->s_inodes_per_block == 0 || sbi->s_inodes_per_group == 0)
 		goto cantfind_ext2;
 	sbi->s_itb_per_group = sbi->s_inodes_per_group /
 					sbi->s_inodes_per_block;