Re: [PATCH] don't divide by 0 when trying to mount ext3

From: Rogier Wolff
Date: Mon Nov 08 2004 - 16:29:31 EST


On Mon, Nov 08, 2004 at 08:59:35PM +0100, Andries Brouwer wrote:
> Not surprisingly, the ext3 code crashes in the same way
> the ext2 code does when dividing by zero.


> + if (sb->s_magic != EXT3_SUPER_MAGIC)
> + goto cantfind_ext3;
[...]
> + if (EXT3_INODE_SIZE(sb) == 0)
> + goto cantfind_ext3;
[...]
> + if (EXT3_BLOCKS_PER_GROUP(sb) == 0)
> + goto cantfind_ext3;

[...]
> +cantfind_ext3:
> + if (!silent)
> + printk(KERN_ERR "VFS: Can't find ext3 filesystem on dev %s.\n",
> + sb->s_id);
> + goto failed_mount;

There are now three cases that end up with the same message and
same error from userspace viewpoint. There are many cases where
debugging a problem is helped when it's possible to find out exactly
which test determined that the filesystem could not be mounted.

How about:

[ ... ] {
errstr = "no magic";
goto cantfind_ext3;
}

--
** R.E.Wolff@xxxxxxxxxxxx ** http://www.BitWizard.nl/ ** +31-15-2600998 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
Q: It doesn't work. A: Look buddy, doesn't work is an ambiguous statement.
Does it sit on the couch all day? Is it unemployed? Please be specific!
Define 'it' and what it isn't doing. --------- Adapted from lxrbot FAQ
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/