[PATCH] mdadm: fix use-after-free after free_mdstat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Zhipeng Xie <xiezhipeng1@xxxxxxxxxx>
---
 Detail.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Detail.c b/Detail.c
index 4dcf81d..860241c 100644
--- a/Detail.c
+++ b/Detail.c
@@ -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);
 
-- 
1.7.12.4

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux