Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/metadata/metadata-exporte ...

PATCH [email protected] 1 participant 1 message Mar 2, 2011

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz at sourceware.org 2011-03-02 20:00:09

Modified files:

	.              : WHATS_NEW 
	lib/metadata   : metadata-exported.h 
	tools          : toollib.c vgchange.c 

Log message:
PE size overflows, on most architectures it is catch by "PE cannot be 0" but s390x unfortunately return something usable.

Always use unit64 in inital parameter check.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1932&r2=1.1933
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.184&r2=1.185
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.223&r2=1.224
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.119&r2=1.120

WHATS_NEW +1 -1
@@ -1,6 +1,6 @@
 Version 2.02.85 - 
 ===================================
-  Fix possible overwlow in maximum stripe size.
+  Fix possible overflow in maximum stripe size and physical extent size.
   Add test for failed allocation from dm_task_set_uuid() in dmeventd.
   Improve pvremove error message when PV belongs to a VG.
   Extend normal policy to allow mirror logs on same PVs as images if necessary.
lib/metadata/metadata-exported.h +1 -0
@@ -34,6 +34,7 @@
 #define STRIPE_SIZE_MAX ( 512L * 1024L >> SECTOR_SHIFT)	/* 512 KB in sectors */
 #define STRIPE_SIZE_LIMIT ((UINT_MAX >> 2) + 1)
 #define MAX_RESTRICTED_LVS 255	/* Used by FMT_RESTRICTED_LVIDS */
+#define MAX_EXTENT_SIZE ((uint32_t) -1)
 
 /* Layer suffix */
 #define MIRROR_SYNC_LAYER "_mimagetmp"
tools/toollib.c +6 -0
@@ -1238,6 +1238,12 @@
 		return 1;
 	}
 
+	if (arg_uint64_value(cmd, physicalextentsize_ARG, 0) > MAX_EXTENT_SIZE) {
+		log_error("Physical extent size cannot be larger than %s",
+				  display_size(cmd, (uint64_t) MAX_EXTENT_SIZE));
+		return 1;
+	}
+
 	if (arg_sign_value(cmd, maxlogicalvolumes_ARG, 0) == SIGN_MINUS) {
 		log_error("Max Logical Volumes may not be negative");
 		return 1;
tools/vgchange.c +6 -0
@@ -356,6 +356,12 @@
 {
 	uint32_t extent_size;
 
+	if (arg_uint64_value(cmd, physicalextentsize_ARG, 0) > MAX_EXTENT_SIZE) {
+		log_error("Physical extent size cannot be larger than %s",
+				  display_size(cmd, (uint64_t) MAX_EXTENT_SIZE));
+		return 1;
+	}
+
 	extent_size = arg_uint_value(cmd, physicalextentsize_ARG, 0);
 	/* FIXME: remove check - redundant with vg_change_pesize */
 	if (extent_size == vg->extent_size) {