diff options
author | Ming-Hung Tsai <notifications@github.com> | 2018-12-14 01:51:51 -0800 |
---|---|---|
committer | Marian Csontos <mcsontos@redhat.com> | 2018-12-19 09:18:25 +0100 |
commit | df0797db8cec82df92fb1df2bace184f5a811924 (patch) | |
tree | ce190e216a88f126f2170e61b640ea3f23b4675f | |
parent | 2d077286b9c6b07fcdd62d834274ae9ab896b195 (diff) | |
download | lvm2-df0797db8cec82df92fb1df2bace184f5a811924.tar.gz |
lvmanip: uninitialized members in struct pv_list (#10)
Scenario: Given an existed LV `lvol0`, I want to create another LV
on the PVs used by `lvol0`.
I use `build_parallel_areas_from_lv()` to obtain the `pv_list` of each segments.
However, the returned `pv_list` is not properly initialized, which causes
segfault in subsequent operations.
(cherry picked from commit 859feb81e5b61ac2109b1d7850844ccf1ce3e5bf)
(cherry picked from commit 219ba4f54a462c175f5e9acaa0558afac94d5ff7)
Conflicts:
WHATS_NEW
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | lib/metadata/lv_manip.c | 2 |
2 files changed, 2 insertions, 1 deletions
@@ -1,5 +1,6 @@ Version 2.02.184 - ===================================== + Fix missing proper initialization of pv_list struct when adding pv. Version 2.02.183 - 07th December 2018 ===================================== diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index e4293cc0f..d1389e7dd 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -5860,7 +5860,7 @@ static int _add_pvs(struct cmd_context *cmd, struct pv_segment *peg, if (find_pv_in_pv_list(&spvs->pvs, peg->pv)) return 1; - if (!(pvl = dm_pool_alloc(cmd->mem, sizeof(*pvl)))) { + if (!(pvl = dm_pool_zalloc(cmd->mem, sizeof(*pvl)))) { log_error("pv_list allocation failed"); return 0; } |