From owner-svn-src-head@FreeBSD.ORG Thu Sep 24 06:00:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 361FF106566B; Thu, 24 Sep 2009 06:00:52 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 255C48FC1F; Thu, 24 Sep 2009 06:00:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8O60pnc086367; Thu, 24 Sep 2009 06:00:51 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8O60o4A086366; Thu, 24 Sep 2009 06:00:50 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200909240600.n8O60o4A086366@svn.freebsd.org> From: Marcel Moolenaar Date: Thu, 24 Sep 2009 06:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197449 - head/sys/geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Sep 2009 06:00:52 -0000 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;