Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Sep 2009 06:00:50 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r197449 - head/sys/geom/part
Message-ID:  <200909240600.n8O60o4A086366@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909240600.n8O60o4A086366>