git: f8fa2f0e7577 - stable/13 - msdosfs: Fix mounting when the device sector size is >512B
Date: Mon, 21 Feb 2022 14:58:12 UTC
The branch stable/13 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=f8fa2f0e7577c5f1cd4239cf73f5e11dcefe61d0
commit f8fa2f0e7577c5f1cd4239cf73f5e11dcefe61d0
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-02-14 14:41:32 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-02-21 14:57:54 +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
Sponsored by: The FreeBSD Foundation
(cherry picked from commit c7cd607a4e28233ab6679ee330c0a4836414bb0a)
---
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 6eab1685ec8e..cbfb0aead8b7 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;