Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Apr 2014 02:20:42 +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: r264184 - head/sys/geom
Message-ID:  <201404060220.s362KgYZ020401@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Sun Apr  6 02:20:42 2014
New Revision: 264184
URL: http://svnweb.freebsd.org/changeset/base/264184

Log:
  Make sure we don't free memory that's already been freed by setting
  the geom->softc pounter to NULL before freeing the g_slicer softc.
  In g_slicer_free() the pointer is checked first.
  
  Obtained from:	Juniper Networks, Inc.

Modified:
  head/sys/geom/geom_slice.c

Modified: head/sys/geom/geom_slice.c
==============================================================================
--- head/sys/geom/geom_slice.c	Sun Apr  6 00:17:41 2014	(r264183)
+++ head/sys/geom/geom_slice.c	Sun Apr  6 02:20:42 2014	(r264184)
@@ -534,11 +534,14 @@ g_slice_new(struct g_class *mp, u_int sl
 void
 g_slice_orphan(struct g_consumer *cp)
 {
+	struct g_slicer *gsp;
 
 	g_trace(G_T_TOPOLOGY, "g_slice_orphan(%p/%s)", cp, cp->provider->name);
 	g_topology_assert();
 
 	/* XXX: Not good enough we leak the softc and its suballocations */
-	g_slice_free(cp->geom->softc);
+	gsp = cp->geom->softc;
+	cp->geom->softc = NULL;
+	g_slice_free(gsp);
 	g_wither_geom(cp->geom, ENXIO);
 }



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