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

Fix unsafe list iteration in segment merge code. [HM]

This commit is contained in:
Alasdair Kergon 2003-08-27 15:30:39 +00:00
parent c2f387296e
commit 8fd3c219fd

View File

@ -46,10 +46,10 @@ static int _merge(struct lv_segment *first, struct lv_segment *second)
int lv_merge_segments(struct logical_volume *lv) int lv_merge_segments(struct logical_volume *lv)
{ {
struct list *segh; struct list *segh, *t;
struct lv_segment *current, *prev = NULL; struct lv_segment *current, *prev = NULL;
list_iterate(segh, &lv->segments) { list_iterate_safe(segh, t, &lv->segments) {
current = list_item(segh, struct lv_segment); current = list_item(segh, struct lv_segment);
if (_merge(prev, current)) if (_merge(prev, current))