Don't attempt to mount file system with clusters larger than MAXBSIZE.

This commit is contained in:
jakllsch 2013-04-15 14:10:59 +00:00
parent 0b320769b0
commit e7f2d5bd6f
1 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_vfsops.c,v 1.100 2012/11/04 17:57:59 jakllsch Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.101 2013/04/15 14:10:59 jakllsch Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.100 2012/11/04 17:57:59 jakllsch Exp $");
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.101 2013/04/15 14:10:59 jakllsch Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -726,6 +726,18 @@ msdosfs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l, struct msd
goto error_exit;
}
/*
* Cluster size must be within limit of MAXBSIZE.
* Many FAT filesystems will not have clusters larger than
* 32KiB due to limits in Windows versions before Vista.
*/
if (pmp->pm_bpcluster > MAXBSIZE) {
DPRINTF(("bpcluster %lu > MAXBSIZE %d\n",
pmp->pm_bpcluster, MAXBSIZE));
error = EINVAL;
goto error_exit;
}
/*
* Release the bootsector buffer.
*/