[PATCH] fix: incremental on invalid container causes segfault

[PATCH] fix: incremental on invalid container causes segfault

am 06.12.2010 07:40:40 von unknown

counterpart of 417f346ee0 for incremental.
If md device has metadata_version="none" super_by_fd() matches supertype=super0.
Call of load_container() dereferences null, so we have to forbid it.

Signed-off-by: Przemyslaw Czarnowski
---
Incremental.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Incremental.c b/Incremental.c
index 8cae1ee..9399f5b 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -134,7 +134,7 @@ int Incremental(char *devname, int verbose, int runstop,
if (must_be_container(dfd)) {
if (!st)
st = super_by_fd(dfd, NULL);
- if (st)
+ if (st && st->ss->load_container)
rv = st->ss->load_container(st, dfd, NULL);

close(dfd);
--
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: incremental on invalid container causes segfault

am 07.12.2010 11:02:35 von NeilBrown

On Mon, 6 Dec 2010 06:40:40 +0000 "Hawrylewicz Czarnowski, Przemyslaw"
wrote:

> counterpart of 417f346ee0 for incremental.
> If md device has metadata_version="none" super_by_fd() matches supertype=super0.
> Call of load_container() dereferences null, so we have to forbid it.
>
> Signed-off-by: Przemyslaw Czarnowski
> ---
> Incremental.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/Incremental.c b/Incremental.c
> index 8cae1ee..9399f5b 100644
> --- a/Incremental.c
> +++ b/Incremental.c
> @@ -134,7 +134,7 @@ int Incremental(char *devname, int verbose, int runstop,
> if (must_be_container(dfd)) {
> if (!st)
> st = super_by_fd(dfd, NULL);
> - if (st)
> + if (st && st->ss->load_container)
> rv = st->ss->load_container(st, dfd, NULL);
>
> close(dfd);


Thanks. Applied.
NeilBrown
--
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