Updates to UFS/FFS superblock integrity checks when reading a superblock.
Check for an uninitialed (zero valued) fs_maxbsize and set it to its minimum valid size (fs_bsize). Uninitialed fs_maxbsize were left by older versions of makefs(8) and the superblock integrity checks fail when they are found. No legitimate superblocks should fail as a result of these changes. MFC after: 1 week Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
04997e19e2
commit
a2d1957bbc
@ -514,6 +514,9 @@ validate_sblock(struct fs *fs, int flags)
|
||||
%jd);
|
||||
FCHK(fs->fs_sbsize, >, SBLOCKSIZE, %jd);
|
||||
FCHK(fs->fs_sbsize, <, (signed)sizeof(struct fs), %jd);
|
||||
/* fix for misconfigured filesystems */
|
||||
if (fs->fs_maxbsize == 0)
|
||||
fs->fs_maxbsize = fs->fs_bsize;
|
||||
FCHK(fs->fs_maxbsize, <, fs->fs_bsize, %jd);
|
||||
FCHK(powerof2(fs->fs_maxbsize), ==, 0, %jd);
|
||||
FCHK(fs->fs_maxbsize, >, FS_MAXCONTIG * fs->fs_bsize, %jd);
|
||||
|
Loading…
Reference in New Issue
Block a user