Skip to content

Commit

Permalink
lvmanip: uninitialized members in struct pv_list (#10)
Browse files Browse the repository at this point in the history
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 859feb8)
(cherry picked from commit 219ba4f)

Conflicts:
	WHATS_NEW
  • Loading branch information
Ming-Hung Tsai authored and csonto committed Dec 19, 2018
1 parent 2d07728 commit df0797d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions WHATS_NEW
Original file line number Diff line number Diff line change
@@ -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
=====================================
Expand Down
2 changes: 1 addition & 1 deletion lib/metadata/lv_manip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit df0797d

Please sign in to comment.