mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Avoid endless loop if lv->segments list is corrupted
This commit is contained in:
parent
e7159c828b
commit
0c67893ce9
@ -2191,6 +2191,12 @@ int vg_validate(struct volume_group *vg)
|
|||||||
if (lv_is_visible(lvl->lv))
|
if (lv_is_visible(lvl->lv))
|
||||||
lv_visible_count++;
|
lv_visible_count++;
|
||||||
|
|
||||||
|
if (!check_lv_segments(lvl->lv, 0)) {
|
||||||
|
log_error(INTERNAL_ERROR "LV segments corrupted in %s.",
|
||||||
|
lvl->lv->name);
|
||||||
|
r = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (lvl->lv->status & VISIBLE_LV)
|
if (lvl->lv->status & VISIBLE_LV)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -2224,6 +2230,10 @@ int vg_validate(struct volume_group *vg)
|
|||||||
r = 0;
|
r = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Avoid endless loop if lv->segments list is corrupt */
|
||||||
|
if (!r)
|
||||||
|
return r;
|
||||||
|
|
||||||
loop_counter1 = loop_counter2 = 0;
|
loop_counter1 = loop_counter2 = 0;
|
||||||
/* FIXME Use temp hash table instead? */
|
/* FIXME Use temp hash table instead? */
|
||||||
dm_list_iterate_items(lvl, &vg->lvs) {
|
dm_list_iterate_items(lvl, &vg->lvs) {
|
||||||
@ -2253,12 +2263,6 @@ int vg_validate(struct volume_group *vg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!check_lv_segments(lvl->lv, 0)) {
|
|
||||||
log_error(INTERNAL_ERROR "LV segments corrupted in %s.",
|
|
||||||
lvl->lv->name);
|
|
||||||
r = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!check_lv_segments(lvl->lv, 1)) {
|
if (!check_lv_segments(lvl->lv, 1)) {
|
||||||
log_error(INTERNAL_ERROR "LV segments corrupted in %s.",
|
log_error(INTERNAL_ERROR "LV segments corrupted in %s.",
|
||||||
lvl->lv->name);
|
lvl->lv->name);
|
||||||
@ -2928,6 +2932,9 @@ struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vgnam
|
|||||||
vg_release(vg);
|
vg_release(vg);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dm_list_iterate_items(lvl, &vg->lvs) {
|
||||||
/*
|
/*
|
||||||
* Checks that cross-reference other LVs.
|
* Checks that cross-reference other LVs.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user