1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

lvconvert: check if LV has cow type

Cow may not be a COW type, the return value of origin_from_cow(cow) may be NULL.

Reported-by: Wu Guanghao <wuguanghao3@huawei.com>
Reported-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
This commit is contained in:
Zdenek Kabelac 2020-09-12 12:08:15 +02:00
parent 463a61e62e
commit a9cb96f146

View File

@ -1825,6 +1825,11 @@ static int _lvconvert_splitsnapshot(struct cmd_context *cmd, struct logical_volu
struct volume_group *vg = cow->vg;
const char *cow_name = display_lvname(cow);
if (!lv_is_cow(cow)) {
log_error(INTERNAL_ERROR "Volume %s is not a COW.", cow_name);
return 0;
}
if (lv_is_virtual_origin(origin_from_cow(cow))) {
log_error("Unable to split off snapshot %s with virtual origin.", cow_name);
return 0;