Re: newfs_msdos and DVD-RAM

From: Fabian Keil <freebsd-listen_at_fabiankeil.de>
Date: Fri, 19 Mar 2010 19:11:33 +0100
Paul B Mahol <onemda_at_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 <fk_at_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
_at__at_ -606,6 +606,12 _at__at_ 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

Received on Fri Mar 19 2010 - 17:10:52 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:01 UTC