Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Dec 2004 20:28:24 +0100
From:      des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=)
To:        geom@freebsd.org
Subject:   Re: GEOM_VOL panics when audio CD is present
Message-ID:  <xzpsm5nvb53.fsf@dwp.des.no>
In-Reply-To: <xzpfz1pksny.fsf@dwp.des.no> (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav's?= message of "Wed, 29 Dec 2004 16:53:05 %2B0100")
References:  <xzpfz1pksny.fsf@dwp.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Any objections to the attached patch?  It's not the most efficient
solution, but it is the one least likely to give us surprises down the
road.

DES
--=20
Dag-Erling Sm=F8rgrav - des@des.no


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=geom_vol.diff

Index: sys/geom/geom_vol_ffs.c
===================================================================
RCS file: /home/ncvs/src/sys/geom/geom_vol_ffs.c,v
retrieving revision 1.13
diff -u -r1.13 geom_vol_ffs.c
--- sys/geom/geom_vol_ffs.c	9 Aug 2004 06:04:00 -0000	1.13
+++ sys/geom/geom_vol_ffs.c	30 Dec 2004 19:22:30 -0000
@@ -88,6 +88,16 @@
 	 * provider based on that.
 	 */
 	for (sb=0; (superblock = superblocks[sb]) != -1; sb++) {
+		/*
+		 * Take care not to issue an invalid I/O request.  The
+		 * offset and size of the superblock candidate must be
+		 * multiples of the provider's sector size, otherwise an
+		 * FFS can't exist on the provider anyway.
+		 */
+		if (superblock % cp->provider->sectorsize != 0 ||
+		    SBLOCKSIZE % cp->provider->sectorsize != 0)
+			continue;
+
 		fs = (struct fs *) g_read_data(cp, superblock,
 			SBLOCKSIZE, &error);
 		if (fs == NULL || error != 0)

--=-=-=--



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