From owner-svn-src-all@FreeBSD.ORG Fri Jul 23 06:30:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F344A1065686; Fri, 23 Jul 2010 06:30:01 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA0F08FC14; Fri, 23 Jul 2010 06:30:01 +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 o6N6U1RH005301; Fri, 23 Jul 2010 06:30:01 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6N6U1c5005299; Fri, 23 Jul 2010 06:30:01 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201007230630.o6N6U1c5005299@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 23 Jul 2010 06:30:01 +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: r210401 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jul 2010 06:30:02 -0000 Author: ae Date: Fri Jul 23 06:30:01 2010 New Revision: 210401 URL: http://svn.freebsd.org/changeset/base/210401 Log: Prevent access after free to table entry in case when user deletes partition that not yet created (changes doesn't committed to disk). PR: 148687 Approved by: mav (mentor) MFC after: 7 days Modified: head/sys/geom/part/g_part.c Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Fri Jul 23 06:01:30 2010 (r210400) +++ head/sys/geom/part/g_part.c Fri Jul 23 06:30:01 2010 (r210401) @@ -830,14 +830,6 @@ g_part_ctl_delete(struct gctl_req *req, entry->gpe_pp = NULL; } - if (entry->gpe_created) { - LIST_REMOVE(entry, gpe_entry); - g_free(entry); - } else { - entry->gpe_modified = 0; - entry->gpe_deleted = 1; - } - if (pp != NULL) g_wither_provider(pp, ENXIO); @@ -850,6 +842,14 @@ g_part_ctl_delete(struct gctl_req *req, gctl_set_param(req, "output", sbuf_data(sb), sbuf_len(sb) + 1); sbuf_delete(sb); } + + if (entry->gpe_created) { + LIST_REMOVE(entry, gpe_entry); + g_free(entry); + } else { + entry->gpe_modified = 0; + entry->gpe_deleted = 1; + } return (0); }