1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

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 859feb81e5)
This commit is contained in:
Ming-Hung Tsai 2018-12-14 01:51:51 -08:00 committed by Marian Csontos
parent d202d54a6c
commit 219ba4f54a
2 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.03.02 - Version 2.03.02 -
=================================== ===================================
Fix missing proper initialization of pv_list struct when adding pv.
Fix (de)activation of RaidLVs with visible SubLVs Fix (de)activation of RaidLVs with visible SubLVs
Prohibit mirrored 'mirror' log via lvcreate and lvconvert Prohibit mirrored 'mirror' log via lvcreate and lvconvert
Use sync io if async io_setup fails, or use_aio=0 is set in config. Use sync io if async io_setup fails, or use_aio=0 is set in config.

View File

@ -5951,7 +5951,7 @@ static int _add_pvs(struct cmd_context *cmd, struct pv_segment *peg,
if (find_pv_in_pv_list(&spvs->pvs, peg->pv)) if (find_pv_in_pv_list(&spvs->pvs, peg->pv))
return 1; 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"); log_error("pv_list allocation failed");
return 0; return 0;
} }