Paul B Mahol <one...@gmail.com> wrote:

> FreeBSD 9.0 CURRENT panics when mounting file system created via
> newfs_msdos on DVD-RAM disc.
> Something to do about divide by zero.

I recently had a similar problem with a 16GB iPod. I still haven't
managed to actually mount it, but the patch below at least works
around the panic.

Does it work for you, too?

From 682d827f591d703e049274f495bf90f41b27c15f Mon Sep 17 00:00:00 2001
From: Fabian Keil <f...@fabiankeil.de>
Date: Fri, 19 Mar 2010 18:59:49 +0100
Subject: [PATCH] Work around weird msdosfs crash on mount. How can SecPerClust 
be zero here?

---
 sys/fs/msdosfs/msdosfs_vfsops.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index f229e91..22913c2 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -606,6 +606,12 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp)
                pmp->pm_firstcluster = pmp->pm_rootdirblk + pmp->pm_rootdirsize;
        }
 
+       if (SecPerClust == 0) {
+               printf("SecPerClust is 0? When did this happen?\n");
+               error = EINVAL;
+               goto error_exit;
+       }
+
        pmp->pm_maxcluster = (pmp->pm_HugeSectors - pmp->pm_firstcluster) /
            SecPerClust + 1;
        pmp->pm_fatsize = pmp->pm_FATsecs * DEV_BSIZE;  /* XXX not used? */
-- 
1.6.6.2

Fabian

Attachment: signature.asc
Description: PGP signature

Reply via email to