summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2005-10-17 03:27:35 +0000
committerrodrigc <rodrigc@FreeBSD.org>2005-10-17 03:27:35 +0000
commit49d8776e0336b16eec91f42c284c191e2b13315a (patch)
tree9ed3ca066e6482eb5a2e19593744c283a869b317 /sys/fs
parentadce9d7a14e5b03e0e41e5ae36ef9ceed55066ca (diff)
downloadFreeBSD-src-49d8776e0336b16eec91f42c284c191e2b13315a.zip
FreeBSD-src-49d8776e0336b16eec91f42c284c191e2b13315a.tar.gz
Use the actual sector size of the media instead of hard-coding it to 2048.
This eliminates KASSERTs in GEOM if we accidentally mount an audio CD as a cd9660 filesystem.
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index cd7e375..6266fb8 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -247,9 +247,18 @@ iso_mountfs(devvp, mp, td)
/* This is the "logical sector size". The standard says this
* should be 2048 or the physical sector size on the device,
- * whichever is greater. For now, we'll just use a constant.
+ * whichever is greater.
*/
- iso_bsize = ISO_DEFAULT_BLOCK_SIZE;
+ if ((ISO_DEFAULT_BLOCK_SIZE % cp->provider->sectorsize) != 0) {
+ DROP_GIANT();
+ g_topology_lock();
+ g_vfs_close(cp, td);
+ g_topology_unlock();
+ PICKUP_GIANT();
+ return (EINVAL);
+ }
+
+ iso_bsize = cp->provider->sectorsize;
joliet_level = 0;
if (1 != vfs_scanopt(mp->mnt_optnew, "ssector", "%d", &ssector))
@@ -257,7 +266,7 @@ iso_mountfs(devvp, mp, td)
for (iso_blknum = 16 + ssector;
iso_blknum < 100 + ssector;
iso_blknum++) {
- if ((error = bread(devvp, iso_blknum * btodb(iso_bsize),
+ if ((error = bread(devvp, iso_blknum * btodb(ISO_DEFAULT_BLOCK_SIZE),
iso_bsize, NOCRED, &bp)) != 0)
goto out;
OpenPOWER on IntegriCloud