svn commit: r210634 - stable/8/sys/geom/part

Andrey V. Elsukov ae at FreeBSD.org
Fri Jul 30 07:30:58 UTC 2010


Author: ae
Date: Fri Jul 30 07:30:57 2010
New Revision: 210634
URL: http://svn.freebsd.org/changeset/base/210634

Log:
  MFC r210401:
    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)

Modified:
  stable/8/sys/geom/part/g_part.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/geom/part/g_part.c
==============================================================================
--- stable/8/sys/geom/part/g_part.c	Fri Jul 30 06:06:33 2010	(r210633)
+++ stable/8/sys/geom/part/g_part.c	Fri Jul 30 07:30:57 2010	(r210634)
@@ -829,14 +829,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);
 
@@ -849,6 +841,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);
 }
 


More information about the svn-src-all mailing list