summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2006-03-03 22:36:52 +0000
committerps <ps@FreeBSD.org>2006-03-03 22:36:52 +0000
commit00f6401a915668e081530bb7039ea323db606098 (patch)
tree6dd618ab82d1b5993d360e446755637efa181b70
parent0ac62e02bddc3f1147599efe9997fc4b09f1d642 (diff)
downloadFreeBSD-src-00f6401a915668e081530bb7039ea323db606098.zip
FreeBSD-src-00f6401a915668e081530bb7039ea323db606098.tar.gz
Fix bug in malloc_uninit():
Releasing items from the mt_zone can not be done by a simple uma_zfree() call since mt_zone is allocated with the UMA_ZONE_MALLOC flag. Use uma_zfree_arg instead and supply the slab. This bug caused panics in low memory situations on unloading kernel modules containing MALLOC_DEFINE(..) statements. Submitted by: ups
-rw-r--r--sys/kern/kern_malloc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 27c2d19..385d0a7 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -622,6 +622,7 @@ malloc_uninit(void *data)
struct malloc_type_internal *mtip;
struct malloc_type_stats *mtsp;
struct malloc_type *mtp, *temp;
+ uma_slab_t slab;
long temp_allocs, temp_bytes;
int i;
@@ -658,7 +659,8 @@ malloc_uninit(void *data)
temp_allocs, temp_bytes);
}
- uma_zfree(mt_zone, mtip);
+ slab = vtoslab((vm_offset_t) mtip & (~UMA_SLAB_MASK));
+ uma_zfree_arg(mt_zone, mtip, slab);
}
struct malloc_type *
OpenPOWER on IntegriCloud