linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix: assemble for external metadata generates segfault if invalid device found
@ 2010-11-30 23:49 Hawrylewicz Czarnowski, Przemyslaw
  2010-12-01  0:06 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Hawrylewicz Czarnowski, Przemyslaw @ 2010-11-30 23:49 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid@vger.kernel.org, Williams, Dan J, Ciechanowski, Ed

An attempt to invoke super_by_fd() on device that has
metadata_version="none" always matches super0 (as test_version is "").
In Assemble() it results in segfault when load_container is invoked
(=null for super0).
As of now load_container is only started if it points to valid pointer.

Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
---
 Assemble.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Assemble.c b/Assemble.c
index 5e71a43..5e4296c 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -332,7 +332,7 @@ int Assemble(struct supertype *st, char *mddev,
 					fprintf(stderr, Name ": not a recognisable container: %s\n",
 						devname);
 				tmpdev->used = 2;
-			} else if (tst->ss->load_container(tst, dfd, NULL)) {
+			} else if (!tst->ss->load_container || tst->ss->load_container(tst, dfd, NULL)) {
 				if (report_missmatch)
 					fprintf(stderr, Name ": no correct container type: %s\n",
 						devname);
-- 
1.7.1


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

end of thread, other threads:[~2010-12-01  0:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-30 23:49 [PATCH] fix: assemble for external metadata generates segfault if invalid device found Hawrylewicz Czarnowski, Przemyslaw
2010-12-01  0:06 ` Neil Brown

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).