In ext2_mountfs(), check that the superblock size, SBSIZE,

is aligned with the sectorsize value returned by GEOM, before
doing a bread() of the superblock.
This eliminates a panic when trying the following on an empty CD-ROM drive:
mount_ext2fs /dev/acd0 /mnt

Reviewed by:	phk
This commit is contained in:
Craig Rodrigues 2005-09-10 21:30:49 +00:00
parent c6c7bd16ce
commit bdb7d194d0

View File

@ -612,6 +612,18 @@ ext2_mountfs(devvp, mp, td)
VOP_UNLOCK(devvp, 0, td);
if (error)
return (error);
/* XXX: should we check for some sectorsize or 512 instead? */
if (((SBSIZE % cp->provider->sectorsize) != 0) ||
(SBSIZE < cp->provider->sectorsize)) {
DROP_GIANT();
g_topology_lock();
g_vfs_close(cp, td);
g_topology_unlock();
PICKUP_GIANT();
return (EINVAL);
}
bo = &devvp->v_bufobj;
bo->bo_private = cp;
bo->bo_ops = g_vfs_bufops;