diff options
author | Lukasz Dorau <lukasz.dorau@intel.com> | 2012-09-27 16:58:44 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-09-27 16:58:44 +1000 |
commit | aec89f63e98322a141d146a84c67b0cc2d1cd1a4 (patch) | |
tree | 69d21724294a68c5c063c4994fe83c46a81e462a | |
parent | c5c56d68ff098c10dd549a9feaa320d3db475bdd (diff) | |
download | mdadm-aec89f63e98322a141d146a84c67b0cc2d1cd1a4.tar.gz |
fix segfaults in Detail()
If disk has been removed, 'st' and 'info' can be NULL. It causes segfault.
'st' and 'info' should be checked against being NULL before being used.
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | Detail.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -424,7 +424,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost, char *pre } free_mdstat(ms); - if (st->sb && info->reshape_active) { + if ((st && st->sb) && (info && info->reshape_active)) { #if 0 This is pretty boring printf(" Reshape pos'n : %llu%s\n", (unsigned long long) info->reshape_progress<<9, @@ -575,7 +575,8 @@ This is pretty boring if (spares && brief && array.raid_disks) printf(" spares=%d", spares); if (brief && st && st->sb) st->ss->brief_detail_super(st); - st->ss->free_super(st); + if (st) + st->ss->free_super(st); if (brief > 1 && devices) printf("\n devices=%s", devices); if (brief) printf("\n"); |