|
@@ -258,12 +258,21 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
|
|
|
|
|
|
/* Do sanity checks on the superblock */
|
|
|
if (super.magic != CRAMFS_MAGIC) {
|
|
|
+ /* check for wrong endianess */
|
|
|
+ if (super.magic == CRAMFS_MAGIC_WEND) {
|
|
|
+ if (!silent)
|
|
|
+ printk(KERN_ERR "cramfs: wrong endianess\n");
|
|
|
+ goto out;
|
|
|
+ }
|
|
|
+
|
|
|
/* check at 512 byte offset */
|
|
|
mutex_lock(&read_mutex);
|
|
|
memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super));
|
|
|
mutex_unlock(&read_mutex);
|
|
|
if (super.magic != CRAMFS_MAGIC) {
|
|
|
- if (!silent)
|
|
|
+ if (super.magic == CRAMFS_MAGIC_WEND && !silent)
|
|
|
+ printk(KERN_ERR "cramfs: wrong endianess\n");
|
|
|
+ else if (!silent)
|
|
|
printk(KERN_ERR "cramfs: wrong magic\n");
|
|
|
goto out;
|
|
|
}
|