[PATCH] fix: assemble for external metadata generates segfault if invalid device found

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

 



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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux