Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Mar 2010 19:11:33 +0100
From:      Fabian Keil <freebsd-listen@fabiankeil.de>
To:        freebsd-current@freebsd.org
Subject:   Re: newfs_msdos and DVD-RAM
Message-ID:  <20100319191133.46fe271c@r500.local>
In-Reply-To: <3a142e751003191021p141af009m6acf7d160c890cbb@mail.gmail.com>
References:  <3a142e751003190508x6a06868ene2e8fd9ddd977f66@mail.gmail.com> <3a142e751003191021p141af009m6acf7d160c890cbb@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/AKpUFSsrAPmy2dZTU0zOT8b
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Paul B Mahol <onemda@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?

=46rom 682d827f591d703e049274f495bf90f41b27c15f Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Fri, 19 Mar 2010 18:59:49 +0100
Subject: [PATCH] Work around weird msdosfs crash on mount. How can SecPerCl=
ust 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_vfsop=
s.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 =3D pmp->pm_rootdirblk + pmp->pm_rootdirsize;
 	}
=20
+	if (SecPerClust =3D=3D 0) {
+		printf("SecPerClust is 0? When did this happen?\n");
+		error =3D EINVAL;
+		goto error_exit;
+	}
+
 	pmp->pm_maxcluster =3D (pmp->pm_HugeSectors - pmp->pm_firstcluster) /
 	    SecPerClust + 1;
 	pmp->pm_fatsize =3D pmp->pm_FATsecs * DEV_BSIZE;	/* XXX not used? */
--=20
1.6.6.2

Fabian

--Sig_/AKpUFSsrAPmy2dZTU0zOT8b
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iEYEARECAAYFAkujvl0ACgkQBYqIVf93VJ28kACguJnUzoumOpJtIQBx55dsPxFt
2LAAoIJviCRzKS4AUoNWpsFqeJvN/ChQ
=zzUu
-----END PGP SIGNATURE-----

--Sig_/AKpUFSsrAPmy2dZTU0zOT8b--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100319191133.46fe271c>