Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/msdosfs Don't attempt to mount file system with clust...



details:   https://anonhg.NetBSD.org/src/rev/4594d9ddd272
branches:  trunk
changeset: 786103:4594d9ddd272
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Mon Apr 15 14:10:59 2013 +0000

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

diffstat:

 sys/fs/msdosfs/msdosfs_vfsops.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 0f210c2c7a82 -r 4594d9ddd272 sys/fs/msdosfs/msdosfs_vfsops.c
--- a/sys/fs/msdosfs/msdosfs_vfsops.c   Mon Apr 15 12:02:47 2013 +0000
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c   Mon Apr 15 14:10:59 2013 +0000
@@ -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 @@
        }
 
        /*
+        * 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);



Home | Main Index | Thread Index | Old Index