[PATCH dmraid 1.0.0.rc14] isw: fix segfault issue with dmraid -r -E

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes a dmraid segmentation fault issue found when running [dmraid 
-r -E] on an Intel isw format mirror set.

Signed-off-by:  Ying Fang <ying.fang@xxxxxxxxx>
Signed-off-by:  Jason Gaston <jason.d.gaston@xxxxxxxxx>

--- lib/format/ataraid/isw.c.org	2007-06-29 13:43:31.000000000 -0700
+++ lib/format/ataraid/isw.c	2007-06-29 11:30:50.000000000 -0700
@@ -264,28 +264,25 @@
 	/* Get the rounded up value for the metadata blocks */
 	size_t blocks = div_up((*isw)->mpb_size, ISW_DISK_BLOCK_SIZE);
 
-	/* No extended metadata to read ? */
-	if (blocks < 2)
-		return 1;
-
 	/*
 	 * Allocate memory for the extended Intel superblock
 	 * and read it in. Reserve one more disk block in order
 	 * to be able to file the metadata in the proper sequence.
-	 * (ie, sectors 1, 2-n, 1 in core so that the filing can start at 2).
+	 * (ie, sectors 1, 2, 1 in core so that the filing can start at 2).
 	 */
 	*size = blocks * ISW_DISK_BLOCK_SIZE;
 	*isw_sboffset -= *size - ISW_DISK_BLOCK_SIZE;
 
 	if ((isw_tmp = alloc_private(lc, handler,
 				     *size + ISW_DISK_BLOCK_SIZE))) {
+		/*Copy in first metadata sector. */
+		memcpy(isw_tmp, *isw, ISW_DISK_BLOCK_SIZE);
+
+
 		/* Read extended metadata to offset ISW_DISK_BLOCK_SIZE */
-		if (read_file(lc, handler, di->path,
+		if ((blocks > 1)&&(!read_file(lc, handler, di->path,
 			      (void*) isw_tmp + ISW_DISK_BLOCK_SIZE,
-			      *size - ISW_DISK_BLOCK_SIZE, *isw_sboffset))
-			/* Copy in first metadata sector. */
-			memcpy(isw_tmp, *isw, ISW_DISK_BLOCK_SIZE);
-		else {
+			      *size - ISW_DISK_BLOCK_SIZE, *isw_sboffset))){
 			dbg_free(isw_tmp);
 			isw_tmp = NULL;
 		}

_______________________________________________
Ataraid-list mailing list
Ataraid-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/ataraid-list

[Index of Archives]     [Linux RAID]     [Linux Device Mapper]     [Linux IDE]     [Linux SCSI]     [Kernel]     [Linux Books]     [Linux Admin]     [GFS]     [RPM]     [Yosemite Campgrounds]     [AMD 64]

  Powered by Linux