diff options
author | pjd <pjd@FreeBSD.org> | 2010-05-31 23:11:43 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2010-05-31 23:11:43 +0000 |
commit | 3cd955d57e0c89f14b4040ae185b7f4050dbc1e5 (patch) | |
tree | 9334063b471488dcc7a8978e80c806a7d4e068b9 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c | |
parent | 4abc4c484d1147acd24fc4d5a3e9cc56c8051a4a (diff) | |
download | FreeBSD-src-3cd955d57e0c89f14b4040ae185b7f4050dbc1e5.zip FreeBSD-src-3cd955d57e0c89f14b4040ae185b7f4050dbc1e5.tar.gz |
Fix panic when reading label from provider with non power of 2 sector size.
Reported by: James R. Van Artsdalen <james-freebsd-fs2@jrv.org>
MFC after: 3 days
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c index b831a9c..9c6ec4c 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c @@ -183,7 +183,7 @@ vdev_geom_io(struct g_consumer *cp, int cmd, void *data, off_t offset, off_t siz { struct bio *bp; u_char *p; - off_t off; + off_t off, maxio; int error; ASSERT((offset % cp->provider->sectorsize) == 0); @@ -193,14 +193,15 @@ vdev_geom_io(struct g_consumer *cp, int cmd, void *data, off_t offset, off_t siz off = offset; offset += size; p = data; + maxio = MAXPHYS - (MAXPHYS % cp->provider->sectorsize); error = 0; - for (; off < offset; off += MAXPHYS, p += MAXPHYS, size -= MAXPHYS) { + for (; off < offset; off += maxio, p += maxio, size -= maxio) { bzero(bp, sizeof(*bp)); bp->bio_cmd = cmd; bp->bio_done = NULL; bp->bio_offset = off; - bp->bio_length = MIN(size, MAXPHYS); + bp->bio_length = MIN(size, maxio); bp->bio_data = p; g_io_request(bp, cp); error = biowait(bp, "vdev_geom_io"); |