Module Name:    src
Committed By:   jakllsch
Date:           Mon Apr 15 14:11:00 UTC 2013

Modified Files:
        src/sys/fs/msdosfs: msdosfs_vfsops.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/fs/msdosfs/msdosfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/msdosfs/msdosfs_vfsops.c
diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.100 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.101
--- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.100	Sun Nov  4 17:57:59 2012
+++ src/sys/fs/msdosfs/msdosfs_vfsops.c	Mon Apr 15 14:10:59 2013
@@ -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"
@@ -727,6 +727,18 @@ msdosfs_mountfs(struct vnode *devvp, str
 	}
 
 	/*
+	 * 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.
 	 */
 	brelse(bp, BC_AGE);

Reply via email to