Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jul 2010 06:30:01 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r210401 - head/sys/geom/part
Message-ID:  <201007230630.o6N6U1c5005299@svn.freebsd.org>

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



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