Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Feb 2022 15:07:04 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: c7cd607a4e28 - main - msdosfs: Fix mounting when the device sector size is >512B
Message-ID:  <202202141507.21EF74c2060107@gitrepo.freebsd.org>

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

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

commit c7cd607a4e28233ab6679ee330c0a4836414bb0a
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-02-14 14:41:32 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-02-14 15:06:47 +0000

    msdosfs: Fix mounting when the device sector size is >512B
    
    HugeSectors * BytesPerSec should be computed before converting
    HugeSectors to a DEV_BSIZE-based count.
    
    Fixes:  ba2c98389b78 ("msdosfs: sanity check sector count from BPB")
    Reviewed by:    kib
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D34264
---
 sys/fs/msdosfs/msdosfs_vfsops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index 15f90c2e0e23..17c1699a584a 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -577,7 +577,6 @@ mountmsdosfs(struct vnode *odevvp, struct mount *mp)
 		goto error_exit;
 	}
 
-	pmp->pm_HugeSectors *= pmp->pm_BlkPerSec;
 	if ((off_t)pmp->pm_HugeSectors * pmp->pm_BytesPerSec <
 	    pmp->pm_HugeSectors /* overflow */ ||
 	    (off_t)pmp->pm_HugeSectors * pmp->pm_BytesPerSec >
@@ -586,6 +585,7 @@ mountmsdosfs(struct vnode *odevvp, struct mount *mp)
 		goto error_exit;
 	}
 
+	pmp->pm_HugeSectors *= pmp->pm_BlkPerSec;
 	pmp->pm_HiddenSects *= pmp->pm_BlkPerSec;	/* XXX not used? */
 	pmp->pm_FATsecs     *= pmp->pm_BlkPerSec;
 	SecPerClust         *= pmp->pm_BlkPerSec;



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