From 1363a5ffb2b13047f143892c7a2d78432fd9d61c Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 24 Oct 2024 23:04:54 +0200 Subject: [PATCH] cov: ensure detached_log_lv exists before use --- lib/metadata/mirror.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c index ddbd4fd19..897588511 100644 --- a/lib/metadata/mirror.c +++ b/lib/metadata/mirror.c @@ -993,7 +993,11 @@ static int _remove_mirror_images(struct logical_volume *lv, /* Mirror with only 1 area is 'in sync'. */ if (new_area_count == 1 && is_temporary_mirror_layer(lv)) { - detached_log_lv = detach_mirror_log(mirrored_seg); + if (!(detached_log_lv = detach_mirror_log(mirrored_seg))) { + log_error("Cannot detach mirror log from %s..", + display_lvname(mirrored_seg->lv)); + return 0; + } if (!_init_mirror_log(lv->vg->cmd, (struct logical_volume*)lv_lock_holder(mirrored_seg->lv), detached_log_lv,