From 1660034c0a0c7199b0843909c756f8f9e42b85f5 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Fri, 30 Sep 2011 12:40:05 -0700 Subject: [PATCH] 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" --- e2fsck/unix.c | 1 + 1 file changed, 1 insertion(+) 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; } -- 1.8.3.1