Dan Williams: Assemble: fix handling of empty container

Martin F. Krafft madduck at alioth.debian.org
Tue Oct 27 19:45:17 UTC 2009


Module: mdadm
Branch: build
Commit: 3ef383aa9616e183cb1eda38fdbe4d7a2ebdfd4c
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=3ef383aa9616e183cb1eda38fdbe4d7a2ebdfd4c

Author: Dan Williams <dan.j.williams at intel.com>
Date:   Tue Aug  4 10:17:23 2009 -0700

Assemble: fix handling of empty container

# mdadm --create /dev/md/ddf /dev/sd[b-e] -n 4 -e ddf
mdadm: container /dev/md/ddf prepared.
# mdadm -Ss
mdadm: stopped /dev/md126
# mdadm -As
mdadm: Container /dev/md/ddf0 has been assembled with 4 drives
Segmentation fault

Reported-by: Artur Wojcik <artur.wojcik at intel.com>
Reported-by: Jacek Danecki <jacek.danecki at intel.com>
Signed-off-by: Dan Williams <dan.j.williams at intel.com>

---

 Assemble.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/Assemble.c b/Assemble.c
index 3c3a004..4578906 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -320,6 +320,8 @@ int Assemble(struct supertype *st, char *mddev,
 				content = tmpdev->content;
 			else
 				content = tst->ss->container_content(tst);
+			if (!content)
+				goto loop; /* empty container */
 
 			tmpdev->content = content->next;
 			if (tmpdev->content == NULL)




More information about the pkg-mdadm-commits mailing list