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 <djwong@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
Darrick J. Wong 2011-09-30 12:40:05 -07:00 committed by Theodore Ts'o
parent a7a63675af
commit 1660034c0a

View 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;
}