linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] FIX: Seg Fault in incremental if BBM log detected
@ 2011-02-16 12:42 Krzysztof Wojcik
  2011-02-17  6:07 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Wojcik @ 2011-02-16 12:42 UTC (permalink / raw)
  To: neilb
  Cc: linux-raid, wojciech.neubauer, adam.kwolek, dan.j.williams,
	ed.ciechanowski

Bug  detected for imsm metadata.
Assembling of array using Incremental switch generate segmentation
fault if BBM log is detected.
Reason: missing return from Incremental_container if BBM is detected
and unnecessary list=NULL assignment.
This patch fix the problem and memory leak in this area.

Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
---
 Incremental.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/Incremental.c b/Incremental.c
index 889184f..26739fe 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -1471,7 +1471,19 @@ static int Incremental_container(struct supertype *st, char *devname,
 	if (list->array.state & (1<<MD_SB_BBM_ERRORS)) {
 		fprintf(stderr, Name ": BBM log found in metadata. "
 					"Cannot activate array(s).\n");
-		list = NULL;
+		/* free container data and exit */
+		while (list) {
+			struct mdinfo *d1 = list->next;
+			struct mdinfo *disk = list->devs;
+			while (disk) {
+				struct mdinfo *d2 = disk->next;
+				free(disk);
+				disk = d2;
+			}
+			free(list);
+			list = d1;
+		}
+		return 2;
 	}
 
 	for (ra = list ; ra ; ra = ra->next) {


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-17  6:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-16 12:42 [PATCH] FIX: Seg Fault in incremental if BBM log detected Krzysztof Wojcik
2011-02-17  6:07 ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).