From 2208ebfe16e5b5cd54c762a5a06edd0681d62fa9 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 6 Dec 2017 13:24:41 +0100 Subject: [PATCH] thin: always clear memory before parsing status Ensure there cannot be 'reused' any data from some previous call. --- WHATS_NEW | 1 + libdm/libdm-deptree.c | 2 +- libdm/libdm-targets.c | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index a5ec3e743..4659d5550 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.177 - ==================================== + Ensure _node_send_message always uses clean status of thin pool. Fix lvmlockd to use pool lock when accessing _tmeta volume. Report expected sanlock_convert errors only when retries fail. Avoid blocking in sanlock_convert on SH to EX lock conversion. diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index 34a15474a..b844a5735 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -1493,7 +1493,7 @@ static int _node_send_messages(struct dm_tree_node *dnode, { struct load_segment *seg; struct thin_message *tmsg; - struct dm_status_thin_pool stp = { 0 }; + struct dm_status_thin_pool stp; const char *uuid; int have_messages; diff --git a/libdm/libdm-targets.c b/libdm/libdm-targets.c index 6577f0744..990d275b6 100644 --- a/libdm/libdm-targets.c +++ b/libdm/libdm-targets.c @@ -350,6 +350,8 @@ int parse_thin_pool_status(const char *params, struct dm_status_thin_pool *s) { int pos; + memset(s, 0, sizeof(*s)); + if (!params) { log_error("Failed to parse invalid thin params."); return 0; @@ -406,7 +408,7 @@ int dm_get_status_thin_pool(struct dm_pool *mem, const char *params, { struct dm_status_thin_pool *s; - if (!(s = dm_pool_zalloc(mem, sizeof(struct dm_status_thin_pool)))) { + if (!(s = dm_pool_alloc(mem, sizeof(struct dm_status_thin_pool)))) { log_error("Failed to allocate thin_pool status structure."); return 0; }