From 6becb3dbf1c2bfbc775806854d8cd00efdd9658c Mon Sep 17 00:00:00 2001 From: Finix1979 Date: Fri, 8 Jul 2022 02:43:58 +0800 Subject: [PATCH] Call nvlist_free before return Fixes a small kernel memory leak which would occur if a pool failed to import because the `DMU_POOL_VDEV_ZAP_MAP` key can't be read from a presumably damaged MOS config. In the case of a missing key there was no leak. Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Finix1979 Closes #13629 --- module/zfs/spa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 5beaba7f4bc4..5288f35d9ad2 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -4211,6 +4211,7 @@ spa_ld_get_props(spa_t *spa) spa->spa_avz_action = AVZ_ACTION_INITIALIZE; ASSERT0(vdev_count_verify_zaps(spa->spa_root_vdev)); } else if (error != 0) { + nvlist_free(mos_config); return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } else if (!nvlist_exists(mos_config, ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS)) { /*