mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-16 15:11:52 +00:00
mountmsdosfs: reject too high value of bytes per cluster
Bytes per cluster are calcuated as bytes per sector times sectors per cluster. Too high value can overflow an internal variable with type that can hold only values in valid range. Trying to use a wider type results in an attempt to read more than MAXBSIZE at once, a panic. Unfortunately, it is FreeBSD newfs_msdos that produces filesystems with invalid parameters for certain types of media. Reported by: Fabian Keil <freebsd-listen@fabiankeil.de>, Paul B. Mahol <onemda@gmail.com> Discussed with: bde, kib MFC after: 1 week X-ToDo: fix newfs_msdos
This commit is contained in:
parent
1b4bc5f851
commit
423b0fb7ad
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=206098
@ -580,6 +580,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp)
|
||||
|| (pmp->pm_BytesPerSec & (pmp->pm_BytesPerSec - 1))
|
||||
|| (pmp->pm_HugeSectors == 0)
|
||||
|| (pmp->pm_FATsecs == 0)
|
||||
|| (SecPerClust * pmp->pm_BlkPerSec > MAXBSIZE / DEV_BSIZE)
|
||||
) {
|
||||
error = EINVAL;
|
||||
goto error_exit;
|
||||
|
Loading…
Reference in New Issue
Block a user