From: Darrick J. Wong Date: Fri, 30 Sep 2011 19:40:05 +0000 (-0700) Subject: e2fsck: zero ctx->fs after freeing fs when restarting due to MMP X-Git-Tag: v1.42-WIP-1001~8 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=1660034c0a0c7199b0843909c756f8f9e42b85f5;p=tools%2Fe2fsprogs.git e2fsck: zero ctx->fs after freeing fs when restarting due to MMP If MMP is enabled and e2fsck determines that it needs to restart itself on account of various MMP conditions, it will close the current fs and jump back to the start of fs checking. However, closing fs also frees it, which means that we need to set ctx->fs to NULL to prevent subsequent open code from accessing the old deleted pointer. Signed-off-by: Darrick J. Wong Signed-off-by: "Theodore Ts'o" --- diff --git a/e2fsck/unix.c b/e2fsck/unix.c index f980962..c95cadd 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -1352,6 +1352,7 @@ failure: */ if (flags & EXT2_FLAG_SKIP_MMP) { ext2fs_close(fs); + ctx->fs = NULL; flags &= ~EXT2_FLAG_SKIP_MMP; goto restart; }