Whamcloud - gitweb
e2fsck: zero ctx->fs after freeing fs when restarting due to MMP
authorDarrick J. Wong <djwong@us.ibm.com>
Fri, 30 Sep 2011 19:40:05 +0000 (12:40 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 1 Oct 2011 01:28:21 +0000 (21:28 -0400)
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 <djwong@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/unix.c

index f980962..c95cadd 100644 (file)
@@ -1352,6 +1352,7 @@ failure:
          */
        if (flags & EXT2_FLAG_SKIP_MMP) {
                ext2fs_close(fs);
+               ctx->fs = NULL;
                flags &= ~EXT2_FLAG_SKIP_MMP;
                goto restart;
        }