aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2005-02-08 08:04:23 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2005-02-08 08:04:23 +0000
commit363de7f68317773fc61b3737bb118e76764098d0 (patch)
treeea5b1ca711bc499ab04755cd9a644b46137767f7 /sys
parent2a05fbb94958d3a01370343fc43c963689586985 (diff)
downloadsrc-363de7f68317773fc61b3737bb118e76764098d0.tar.gz
src-363de7f68317773fc61b3737bb118e76764098d0.zip
Take care not to issue unaligned I/O requests while tasting a provider.
Notes
Notes: svn path=/head/; revision=141498
Diffstat (limited to 'sys')
-rw-r--r--sys/geom/geom_vol_ffs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/geom/geom_vol_ffs.c b/sys/geom/geom_vol_ffs.c
index 94175f74e236..d90222f7f6e7 100644
--- a/sys/geom/geom_vol_ffs.c
+++ b/sys/geom/geom_vol_ffs.c
@@ -88,6 +88,16 @@ g_vol_ffs_taste(struct g_class *mp, struct g_provider *pp, int flags)
* 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)