diff --git a/WHATS_NEW b/WHATS_NEW index 15f835bd7..d622c9fba 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.140 - =================================== + Fix invalid memory read when reporting cache LV policy_name (2.02.126). Version 2.02.139 - 8th January 2016 =================================== diff --git a/lib/report/report.c b/lib/report/report.c index 91522b10b..2fdf509d8 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -1417,6 +1417,7 @@ static int _cache_policy_disp(struct dm_report *rh, struct dm_pool *mem, const void *data, void *private) { const struct lv_segment *seg = (const struct lv_segment *) data; + const char *cache_policy_name; if (seg_is_cache(seg)) seg = first_seg(seg->pool_lv); @@ -1429,7 +1430,12 @@ static int _cache_policy_disp(struct dm_report *rh, struct dm_pool *mem, return 0; } - return _field_set_value(field, seg->policy_name, NULL); + if (!(cache_policy_name = dm_pool_strdup(mem, seg->policy_name))) { + log_error("dm_pool_strdup failed"); + return 0; + } + + return _field_set_value(field, cache_policy_name, NULL); } static int _modules_disp(struct dm_report *rh, struct dm_pool *mem,