From patchwork Fri Aug 16 17:05:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 267712 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id AEFCF2C0098 for ; Sat, 17 Aug 2013 03:06:00 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752751Ab3HPRF6 (ORCPT ); Fri, 16 Aug 2013 13:05:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8628 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752518Ab3HPRF5 (ORCPT ); Fri, 16 Aug 2013 13:05:57 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7GH5vVU032535 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 Aug 2013 13:05:57 -0400 Received: from Liberator.local (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r7GH5tXW025132 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 16 Aug 2013 13:05:56 -0400 Message-ID: <520E5BF3.5090502@redhat.com> Date: Fri, 16 Aug 2013 12:05:55 -0500 From: Eric Sandeen User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: ext4 development CC: Hubert Kario Subject: [PATCH] e2fsck: don't try to stop mmp if there is no superblock set up X-Enigmail-Version: 1.5.2 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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. Reported-by: Hubert Kario Addresses-Red-Hat-Bugzilla: #997972 Signed-off-by: Eric Sandeen --- -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/e2fsck/util.c b/e2fsck/util.c index 9eaf557..18005f4 100644 --- a/e2fsck/util.c +++ b/e2fsck/util.c @@ -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);