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

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

am 01.12.2010 00:49:52 von unknown

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
---
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] fix: assemble for external metadata generates segfaultif invalid device found

am 01.12.2010 01:06:29 von NeilBrown

On Tue, 30 Nov 2010 23:49:52 +0000 "Hawrylewicz Czarnowski, Przemyslaw"
wrote:

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

applied, thanks.

NeilBrown


>
> Signed-off-by: Przemyslaw Czarnowski
> ---
> 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);

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