diff options
author | NeilBrown <neilb@suse.de> | 2009-09-25 09:56:22 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-09-25 09:56:22 +0200 |
commit | 40d28f0d1bf28bc706b734932f46a9190b9fec5b (patch) | |
tree | b6e07d9c6a71c146b4f1faa39dcafae867c1c15f /super0.c | |
parent | Release mdadm-3.0.1 (diff) | |
download | mdadm-40d28f0d1bf28bc706b734932f46a9190b9fec5b.tar.xz mdadm-40d28f0d1bf28bc706b734932f46a9190b9fec5b.zip |
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@agmk.net>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super0.c')
-rw-r--r-- | super0.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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); } |