aboutsummaryrefslogtreecommitdiff
path: root/sys/geom
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2014-04-06 02:20:42 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2014-04-06 02:20:42 +0000
commit12b2d77da9138382650bbec24545cef377b1b860 (patch)
treeeed4913dfac1be88aedc4e73296e1b6442fac4a4 /sys/geom
parent2d1e88da97f1ec753fe4b38fd2a0c0b1802b44d4 (diff)
downloadsrc-12b2d77da9138382650bbec24545cef377b1b860.tar.gz
src-12b2d77da9138382650bbec24545cef377b1b860.zip
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.
Notes
Notes: svn path=/head/; revision=264184
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom_slice.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c
index f40a4de129e3..2102ae9c0809 100644
--- a/sys/geom/geom_slice.c
+++ b/sys/geom/geom_slice.c
@@ -534,11 +534,14 @@ g_slice_new(struct g_class *mp, u_int slices, struct g_provider *pp, struct g_co
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);
}