We don't want ext2fs_open2() to report bad sb checksum on something
that's not even an ext* superblock. This apparently happens pretty
easily if we try to open an XFS filesystem. Thus, make it so that a
bad magic number code always trumps the sb checksum error code.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
retval = EXT2_ET_UNKNOWN_CSUM;
if (!ext2fs_superblock_csum_verify(fs, fs->super))
retval = EXT2_ET_SB_CSUM_INVALID;
- if (retval)
- goto cleanup;
}
#ifdef WORDS_BIGENDIAN
}
#endif
- if (fs->super->s_magic != EXT2_SUPER_MAGIC) {
+ if (fs->super->s_magic != EXT2_SUPER_MAGIC)
retval = EXT2_ET_BAD_MAGIC;
+ if (retval)
goto cleanup;
- }
+
if (fs->super->s_rev_level > EXT2_LIB_CURRENT_REV) {
retval = EXT2_ET_REV_TOO_HIGH;
goto cleanup;