mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
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:
parent
c6c7bd16ce
commit
bdb7d194d0
1 changed files with 12 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue