aboutsummaryrefslogtreecommitdiff
path: root/sys/geom
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2009-09-24 06:00:49 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2009-09-24 06:00:49 +0000
commit87f4470620d060eec659ce296b55cb93957657f2 (patch)
treed965a391281e3ddc57fa27479250f7b99acaf7ec /sys/geom
parentb13c5f2883af97cfb324a9884394b2e47b85a028 (diff)
downloadsrc-87f4470620d060eec659ce296b55cb93957657f2.tar.gz
src-87f4470620d060eec659ce296b55cb93957657f2.zip
Don't create more partitions than can fit in the table by checking
that the index is within bounds.
Notes
Notes: svn path=/head/; revision=197449
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/part/g_part.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c
index 78c36501326b..6e81a9c70b68 100644
--- a/sys/geom/part/g_part.c
+++ b/sys/geom/part/g_part.c
@@ -480,6 +480,10 @@ g_part_ctl_add(struct gctl_req *req, struct g_part_parms *gpp)
gctl_error(req, "%d index '%d'", EEXIST, gpp->gpp_index);
return (EEXIST);
}
+ if (index > table->gpt_entries) {
+ gctl_error(req, "%d index '%d'", ENOSPC, index);
+ return (ENOSPC);
+ }
entry = (delent == NULL) ? g_malloc(table->gpt_scheme->gps_entrysz,
M_WAITOK | M_ZERO) : delent;