mdadm: fix use-after-free after free_mdstat

e->percent access the mdstat_ent which was already freed in free_mdstat

Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
This commit is contained in:
Zhipeng Xie 2018-04-10 09:25:39 +08:00 committed by Jes Sorensen
parent 6a173ed317
commit 1c7c65a3e5
1 changed files with 2 additions and 1 deletions

View File

@ -561,7 +561,6 @@ int Detail(char *dev, struct context *c)
printf(" %7s Status : %d%% complete\n",
sync_action[e->resync], e->percent);
}
free_mdstat(ms);
if ((st && st->sb) && (info && info->reshape_active)) {
#if 0
@ -609,6 +608,8 @@ This is pretty boring
printf("\n");
} else if (e && e->percent >= 0)
printf("\n");
free_mdstat(ms);
if (st && st->sb)
st->ss->detail_super(st, c->homehost);