NeilBrown: super0: fix crash on assemble if homehost is not set.
Martin F. Krafft
madduck at alioth.debian.org
Tue Oct 27 19:21:30 UTC 2009
Module: mdadm
Branch: master
Commit: 40d28f0d1bf28bc706b734932f46a9190b9fec5b
URL: http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=40d28f0d1bf28bc706b734932f46a9190b9fec5b
Author: NeilBrown <neilb at suse.de>
Date: Fri Sep 25 17:56:22 2009 +1000
super0: fix crash on assemble if homehost is not set.
If homehost is not set - typically during early boot,
and assemble of v0.90 metadata arrays will crash.
Reported-by: Paweł Sikora <pluto at agmk.net>
Signed-off-by: NeilBrown <neilb at suse.de>
---
super0.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/super0.c b/super0.c
index 2b4942f..07f4792 100644
--- a/super0.c
+++ b/super0.c
@@ -305,9 +305,13 @@ static int match_home0(struct supertype *st, char *homehost)
{
mdp_super_t *sb = st->sb;
char buf[20];
- char *hash = sha1_buffer(homehost,
- strlen(homehost),
- buf);
+ char *hash;
+
+ if (!homehost)
+ return 0;
+ hash = sha1_buffer(homehost,
+ strlen(homehost),
+ buf);
return (memcmp(&sb->set_uuid2, hash, 8)==0);
}
More information about the pkg-mdadm-commits
mailing list