summaryrefslogtreecommitdiff
path: root/sys/msdosfs/msdosfs_fat.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2009-01-05 01:14:41 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2009-01-05 01:14:41 +0000
commit009d0e9c3e3f56565c0873761901440ad7b2955a (patch)
treee976ae249864d579cca112456563735176456882 /sys/msdosfs/msdosfs_fat.c
parentc0b59b63e9aa761b8457b43e7fa34a224dfe4c9b (diff)
The FAT32 fsinxtfree field is advisory in nature and we don't use
it. So leave it untouched. Similiar to but more ruthless than the fixes FreeBSD did, since they do use the value. Basically avoid various off-by-one and off-by-many errors. Fixes problems encountered by jsg@ and deraadt@ where filesystems found on SDHC cards caused UVM faults. Original fixes found by jsg@. ok jsg@.
Diffstat (limited to 'sys/msdosfs/msdosfs_fat.c')
-rw-r--r--sys/msdosfs/msdosfs_fat.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/sys/msdosfs/msdosfs_fat.c b/sys/msdosfs/msdosfs_fat.c
index 325620473ee..9f8d1dab8d3 100644
--- a/sys/msdosfs/msdosfs_fat.c
+++ b/sys/msdosfs/msdosfs_fat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_fat.c,v 1.19 2006/12/16 12:44:05 krw Exp $ */
+/* $OpenBSD: msdosfs_fat.c,v 1.20 2009/01/05 01:14:40 krw Exp $ */
/* $NetBSD: msdosfs_fat.c,v 1.26 1997/10/17 11:24:02 ws Exp $ */
/*-
@@ -348,22 +348,6 @@ updatefats(pmp, bp, fatbn)
* If we have an FSInfo block, update it.
*/
if (pmp->pm_fsinfo) {
- uint32_t cn = pmp->pm_nxtfree;
-
- if (pmp->pm_freeclustercount
- && (pmp->pm_inusemap[cn / N_INUSEBITS]
- & (1 << (cn % N_INUSEBITS)))) {
- /*
- * The cluster indicated in FSInfo isn't free
- * any longer. Got get a new free one.
- */
- for (cn = 0; cn < pmp->pm_maxcluster; cn++)
- if (pmp->pm_inusemap[cn / N_INUSEBITS] != (u_int)-1)
- break;
- pmp->pm_nxtfree = cn
- + ffs(pmp->pm_inusemap[cn / N_INUSEBITS]
- ^ (u_int)-1) - 1;
- }
if (bread(pmp->pm_devvp, pmp->pm_fsinfo, fsi_size(pmp), NOCRED,
&bpn) != 0) {
/*
@@ -375,7 +359,6 @@ updatefats(pmp, bp, fatbn)
struct fsinfo *fp = (struct fsinfo *)bpn->b_data;
putulong(fp->fsinfree, pmp->pm_freeclustercount);
- putulong(fp->fsinxtfree, pmp->pm_nxtfree);
if (pmp->pm_flags & MSDOSFSMNT_WAITONFAT)
bwrite(bpn);
else