diff options
author | ae <ae@FreeBSD.org> | 2011-01-12 13:55:01 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2011-01-12 13:55:01 +0000 |
commit | f8ef0d32cf854dfdcbc9ec390db2b3e0e8612cab (patch) | |
tree | 5cbe494680286dd7462dc1c7708c012787dde661 | |
parent | c81547364f4a0e0c89fc0ea0e7916c068844860e (diff) | |
download | FreeBSD-src-f8ef0d32cf854dfdcbc9ec390db2b3e0e8612cab.zip FreeBSD-src-f8ef0d32cf854dfdcbc9ec390db2b3e0e8612cab.tar.gz |
Sector size can not be greater than MAXPHYS. Since GRAID3 calculates
sector size from user-specified block size, report to user about
big blocksize.
PR: kern/147851
MFC after: 1 week
-rw-r--r-- | sbin/geom/class/raid3/geom_raid3.c | 5 | ||||
-rw-r--r-- | sys/geom/raid3/g_raid3.c | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/sbin/geom/class/raid3/geom_raid3.c b/sbin/geom/class/raid3/geom_raid3.c index 7afc71e..3f037cd 100644 --- a/sbin/geom/class/raid3/geom_raid3.c +++ b/sbin/geom/class/raid3/geom_raid3.c @@ -213,6 +213,11 @@ raid3_label(struct gctl_req *req) md.md_sectorsize = sectorsize * (nargs - 2); md.md_mediasize -= (md.md_mediasize % md.md_sectorsize); + if (md.md_sectorsize > MAXPHYS) { + gctl_error(req, "The blocksize is too big."); + return; + } + /* * Clear last sector first, to spoil all components if device exists. */ diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c index 08792fe..110b3f9 100644 --- a/sys/geom/raid3/g_raid3.c +++ b/sys/geom/raid3/g_raid3.c @@ -2913,6 +2913,10 @@ g_raid3_read_metadata(struct g_consumer *cp, struct g_raid3_metadata *md) cp->provider->name); return (error); } + if (md->md_sectorsize > MAXPHYS) { + G_RAID3_DEBUG(0, "The blocksize is too big."); + return (EINVAL); + } return (0); } |