Skip to contentSkip to conversation

e2fsck: don't try to stop mmp if there is no superblock set up

PATCH Applied Eric Sandeen 2 participants 2 messages Aug 16, 2013 – Sep 9, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e2fsck: don't try to stop mmp if there is no superblock set up

Under some failure cases, we can get to fatal_error() without even having a superblock set up. In that case, ext2fs_mmp_stop() will segfault when it tries to dereference fs->super.

Check for the existence of a superblock before we go down the ext2fs_mmp_stop() path to avoid this problem.

Addresses-Red-Hat-Bugzilla: #997972

---

e2fsck/util.c +1 -1
index 9eaf557..18005f4 100644
@@ -55,7 +55,7 @@ void fatal_error(e2fsck_t ctx, const char *msg)
 		fprintf (stderr, "e2fsck: %s\n", msg);
 	if (!fs)
 		goto out;
-	if (fs->io) {
+	if (fs->io && fs->super) {
 		ext2fs_mmp_stop(ctx->fs);
 		if (ctx->fs->io->magic == EXT2_ET_MAGIC_IO_CHANNEL)
 			io_channel_flush(ctx->fs->io);
#1 lore raw
Quoted 11 lines · Eric Sandeen

Under some failure cases, we can get to fatal_error() without even having a superblock set up. In that case, ext2fs_mmp_stop() will segfault when it tries to dereference fs->super.

Check for the existence of a superblock before we go down the ext2fs_mmp_stop() path to avoid this problem.

Addresses-Red-Hat-Bugzilla: #997972

Thanks, applied.

- Ted