From f787b575b52fcbfa8327d083eae4f2baf296b1cf Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 19 Apr 2013 21:19:54 +0200 Subject: [PATCH] lvmetad: fix error paths Also add missing goto out on error. Error path missed return NULL leading to double free of enc_value. --- WHATS_NEW | 1 + lib/cache/lvmetad.c | 4 +++- lib/config/config.c | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index 95b6e1387..819fea491 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.99 - =================================== + Fix lvmetad error path in lvmetad_vg_lookup() for null vgname. Fix clvmd _cluster_request() return code in memory fail path. Add writemostly/writebehind support for RAID1 Add lv_change_activate() for common activation code in vg/lvchange. diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c index 4ea3dbd9b..348827d60 100644 --- a/lib/cache/lvmetad.c +++ b/lib/cache/lvmetad.c @@ -343,8 +343,10 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna reply = _lvmetad_send("vg_lookup", "uuid = %s", uuid, NULL); diag_name = uuid; } else { - if (!vgname) + if (!vgname) { log_error(INTERNAL_ERROR "VG name required (VGID not available)"); + goto out; + } log_debug_lvmetad("Asking lvmetad for VG %s", vgname); reply = _lvmetad_send("vg_lookup", "name = %s", vgname, NULL); diag_name = vgname; diff --git a/lib/config/config.c b/lib/config/config.c index d1cf590ff..d420d8332 100644 --- a/lib/config/config.c +++ b/lib/config/config.c @@ -967,6 +967,7 @@ static struct dm_config_value *_get_def_array_values(struct dm_config_tree *cft, if (!(v = dm_config_create_value(cft))) { log_error("Failed to create default config array value for %s.", def->name); dm_free(enc_value); + return NULL; } if (oldv) oldv->next = v;