diff options
author | Chunwei Chen <[email protected]> | 2016-05-27 15:48:02 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-05-31 16:05:21 -0700 |
commit | 6a7967253064a0b8711ca746a1296ee6439d36e6 (patch) | |
tree | d40599e243f0db5bce735727287a0ec89645f193 /module/zfs/vdev_label.c | |
parent | 06ee0031a6d658bbf4ab953070ff4cdf4af64496 (diff) |
Fix memleak in vdev_config_generate_stats
fnvlist_add_nvlist will copy the contents of nvx, so we need to
free it here.
unreferenced object 0xffff8800a6934e80 (size 64):
comm "zpool", pid 3398, jiffies 4295007406 (age 214.180s)
hex dump (first 32 bytes):
60 06 c2 73 00 88 ff ff 00 7c 8c 73 00 88 ff ff `..s.....|.s....
00 00 00 00 00 00 00 00 40 b0 70 c0 ff ff ff ff [email protected].....
backtrace:
[<ffffffff81810c4e>] kmemleak_alloc+0x4e/0xb0
[<ffffffff811fac7d>] __kmalloc_node+0x17d/0x310
[<ffffffffc065528c>] spl_kmem_alloc_impl+0xac/0x180 [spl]
[<ffffffffc0657379>] spl_vmem_alloc+0x19/0x20 [spl]
[<ffffffffc07056cf>] nv_alloc_sleep_spl+0x1f/0x30 [znvpair]
[<ffffffffc07006b7>] nvlist_xalloc.part.13+0x27/0xc0 [znvpair]
[<ffffffffc07007ad>] nvlist_alloc+0x3d/0x40 [znvpair]
[<ffffffffc0703abc>] fnvlist_alloc+0x2c/0x80 [znvpair]
[<ffffffffc07b1783>] vdev_config_generate_stats+0x83/0x370 [zfs]
[<ffffffffc07b1f53>] vdev_config_generate+0x4e3/0x650 [zfs]
[<ffffffffc07996db>] spa_config_generate+0x20b/0x4b0 [zfs]
[<ffffffffc0794f64>] spa_tryimport+0xc4/0x430 [zfs]
[<ffffffffc07d11d8>] zfs_ioc_pool_tryimport+0x68/0x110 [zfs]
[<ffffffffc07d4fc6>] zfsdev_ioctl+0x646/0x7a0 [zfs]
[<ffffffff81232e31>] do_vfs_ioctl+0xa1/0x5b0
[<ffffffff812333b9>] SyS_ioctl+0x79/0x90
Signed-off-by: Chunwei Chen <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #4707
Issue #4708
Diffstat (limited to 'module/zfs/vdev_label.c')
-rw-r--r-- | module/zfs/vdev_label.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/module/zfs/vdev_label.c b/module/zfs/vdev_label.c index 59bce1370..1925c67ed 100644 --- a/module/zfs/vdev_label.c +++ b/module/zfs/vdev_label.c @@ -346,6 +346,7 @@ vdev_config_generate_stats(vdev_t *vd, nvlist_t *nv) /* Add extended stats nvlist to main nvlist */ fnvlist_add_nvlist(nv, ZPOOL_CONFIG_VDEV_STATS_EX, nvx); + fnvlist_free(nvx); kmem_free(vsx, sizeof (*vsx)); } |