diff options
author | Hawrylewicz Czarnowski, Przemyslaw <przemyslaw.hawrylewicz.czarnowski@intel.com> | 2010-12-01 01:06:09 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-12-01 01:06:09 +0100 |
commit | 417f346ee0cc59607a236fd4db8c79dee0825fb1 (patch) | |
tree | 85b88282bae113a2ca053830d3b476c1a955e12f /Assemble.c | |
parent | Create: report failure if array cannot be started. (diff) | |
download | mdadm-417f346ee0cc59607a236fd4db8c79dee0825fb1.tar.xz mdadm-417f346ee0cc59607a236fd4db8c79dee0825fb1.zip |
fix: assemble for external metadata generates segfault if invalid device found
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>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to '')
-rw-r--r-- | Assemble.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -332,7 +332,8 @@ 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); |