Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jun 2022 18:05:36 GMT
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 800a53b445e7 - main - Bug fix to UFS/FFS superblock integrity checks when reading a superblock.
Message-ID:  <202206111805.25BI5a5r019719@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mckusick:

URL: https://cgit.FreeBSD.org/src/commit/?id=800a53b445e7eb113ba193b1ac98631299178529

commit 800a53b445e7eb113ba193b1ac98631299178529
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2022-06-11 18:04:19 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2022-06-11 18:05:14 +0000

    Bug fix to UFS/FFS superblock integrity checks when reading a superblock.
    
    One of the checks was that the cylinder group size (fs_cgsize)
    matched that calculated by CGSIZE(). The value calculated by CGSIZE()
    has changed over time as the filesystem has evolved. Thus comparing
    the value of CGSIZE() of the current generation filesystem may not
    match the size as computed by CGSIZE() that was in effect at the
    time an older filesystem was created. Therefore the check for
    fs_cgsize is changed to simply ensure that it is not larger than
    the filesystem blocksize (fs_bsize).
    
    Reported by: Martin Birgmeier
    Tested by:   Martin Birgmeier
    MFC after:   1 month (with 076002f24d35)
    PR:          264450
    Differential Revision: https://reviews.freebsd.org/D35219
---
 sys/ufs/ffs/ffs_subr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c
index f25a6cba12f4..3e31746c2cfc 100644
--- a/sys/ufs/ffs/ffs_subr.c
+++ b/sys/ufs/ffs/ffs_subr.c
@@ -385,7 +385,7 @@ validate_sblock(struct fs *fs, int isaltsblk)
 		roundup(howmany(SBLOCKSIZE, fs->fs_fsize), fs->fs_frag) ||
 	    fs->fs_iblkno != fs->fs_cblkno + fs->fs_frag ||
 	    fs->fs_dblkno != fs->fs_iblkno + fs->fs_ipg / INOPF(fs) ||
-	    fs->fs_cgsize != fragroundup(fs, CGSIZE(fs)))
+	    fs->fs_cgsize > fs->fs_bsize)
 		return (ENOENT);
 	if (fs->fs_csaddr != cgdmin(fs, 0) ||
 	    fs->fs_cssize !=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206111805.25BI5a5r019719>