linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Liu <net147@gmail.com>
To: linux-raid@vger.kernel.org
Subject: Re: mse->metadata_version segmentation fault
Date: Tue, 12 Apr 2011 19:43:02 +1000	[thread overview]
Message-ID: <4DA41EA6.1030203@gmail.com> (raw)
In-Reply-To: <4DA40F85.4060106@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

On 12/04/2011 6:38 PM, Jonathan Liu wrote:
> Just wanted to post an additional patch to fix segmentation fault with 
> mdadm that was missed by eb28e119b03fd5149886ed516fa4bb006ad3602e.
Slightly better formatted commit patch attached.

Regards,
Jonathan

[-- Attachment #2: metadata_version.patch --]
[-- Type: text/plain, Size: 1039 bytes --]

From 2dce5f9292bba3cfe1cd89408114087b5df7638f Mon Sep 17 00:00:00 2001
From: Jonathan Liu <net147@gmail.com>
Date: Tue, 12 Apr 2011 18:28:01 +1000
Subject: [PATCH] Monitor: avoid NULL dereference with 0.90 metadata

0.90 array do not report the metadata type in /proc/mdstat, so
we cannot assume that mse->metadata_version is non-NULL.

So add an appropriate check.

This adds an additional check missed by commit
eb28e119b03fd5149886ed516fa4bb006ad3602e.
---
 Monitor.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Monitor.c b/Monitor.c
index a3ea724..55aebeb 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -577,7 +577,8 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
 			info[i].major = info[i].minor = 0;
 	}
 
-	if (strncmp(mse->metadata_version, "external:", 9) == 0 &&
+	if (mse->metadata_version &&
+	    strncmp(mse->metadata_version, "external:", 9) == 0 &&
 	    is_subarray(mse->metadata_version+9))
 		st->parent_dev =
 			devname2devnum(mse->metadata_version+10);
-- 
1.7.4.4


      reply	other threads:[~2011-04-12  9:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12  8:38 mse->metadata_version segmentation fault Jonathan Liu
2011-04-12  9:43 ` Jonathan Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DA41EA6.1030203@gmail.com \
    --to=net147@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).