6575997 Memory corruption while running ztest
authormarks
Mon, 09 Jul 2007 10:14:41 -0700
changeset 4611 0960c3336815
parent 4610 9a1f29e24fe7
child 4612 294ac629d818
6575997 Memory corruption while running ztest
usr/src/uts/common/fs/zfs/spa_history.c
usr/src/uts/common/fs/zfs/zfs_ioctl.c
--- a/usr/src/uts/common/fs/zfs/spa_history.c	Mon Jul 09 09:05:11 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/spa_history.c	Mon Jul 09 10:14:41 2007 -0700
@@ -254,6 +254,9 @@
 		    history_str) == 0);
 	}
 
+	VERIFY(nvlist_size(nvrecord, &reclen, NV_ENCODE_XDR) == 0);
+	record_packed = kmem_alloc(reclen, KM_SLEEP);
+
 	VERIFY(nvlist_pack(nvrecord, &record_packed, &reclen,
 	    NV_ENCODE_XDR, KM_SLEEP) == 0);
 
--- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c	Mon Jul 09 09:05:11 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c	Mon Jul 09 10:14:41 2007 -0700
@@ -646,6 +646,7 @@
 	if (size > zc->zc_nvlist_dst_size) {
 		error = ENOMEM;
 	} else {
+		packed = kmem_alloc(size, KM_SLEEP);
 		VERIFY(nvlist_pack(nvl, &packed, &size, NV_ENCODE_NATIVE,
 		    KM_SLEEP) == 0);
 		error = xcopyout(packed, (void *)(uintptr_t)zc->zc_nvlist_dst,