svn commit: r197449 - head/sys/geom/part

Marcel Moolenaar marcel at FreeBSD.org
Thu Sep 24 06:00:52 UTC 2009


Author: marcel
Date: Thu Sep 24 06:00:49 2009
New Revision: 197449
URL: http://svn.freebsd.org/changeset/base/197449

Log:
  Don't create more partitions than can fit in the table by checking
  that the index is within bounds.

Modified:
  head/sys/geom/part/g_part.c

Modified: head/sys/geom/part/g_part.c
==============================================================================
--- head/sys/geom/part/g_part.c	Thu Sep 24 02:15:05 2009	(r197448)
+++ head/sys/geom/part/g_part.c	Thu Sep 24 06:00:49 2009	(r197449)
@@ -480,6 +480,10 @@ g_part_ctl_add(struct gctl_req *req, str
 		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;


More information about the svn-src-head mailing list