git: c7cd607a4e28 - main - msdosfs: Fix mounting when the device sector size is >512B
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 14 Feb 2022 15:07:04 UTC
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;