]> sourceware.org Git - lvm2.git/commitdiff
lv_manip: add extra internal error
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 20 Jun 2018 08:44:13 +0000 (10:44 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Fri, 22 Jun 2018 21:37:02 +0000 (23:37 +0200)
Catch error early, when trying to store data into non-allocated area.

lib/metadata/lv_manip.c

index 27cd2c15dd5d41c27dca732debb3cf3c9677e031..4efe04a372802c6cda45cedd8ea8a91608b2da9a 100644 (file)
@@ -1190,6 +1190,11 @@ int set_lv_segment_area_lv(struct lv_segment *seg, uint32_t area_num,
                         display_lvname(seg->lv), seg->le, area_num,
                         display_lvname(lv), le);
 
+       if (area_num >= seg->area_count) {
+               log_error(INTERNAL_ERROR "Try to set to high area number (%u >= %u) for LV %s.",
+                         area_num, seg->area_count, display_lvname(seg->lv));
+               return 0;
+       }
        lv->status |= status;
        if (lv_is_raid_metadata(lv)) {
                seg->meta_areas[area_num].type = AREA_LV;
This page took 0.046417 seconds and 5 git commands to generate.