From patchwork Tue Sep 1 21:43:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 32770 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 05D0BB7BAA for ; Wed, 2 Sep 2009 07:43:22 +1000 (EST) Received: by ozlabs.org (Postfix) id EA607DDD0B; Wed, 2 Sep 2009 07:43:21 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 724F6DDD01 for ; Wed, 2 Sep 2009 07:43:21 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755220AbZIAVnQ (ORCPT ); Tue, 1 Sep 2009 17:43:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755223AbZIAVnQ (ORCPT ); Tue, 1 Sep 2009 17:43:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33909 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755220AbZIAVnQ (ORCPT ); Tue, 1 Sep 2009 17:43:16 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n81LhInn016156 for ; Tue, 1 Sep 2009 17:43:18 -0400 Received: from neon.msp.redhat.com (neon.msp.redhat.com [10.15.80.10]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n81LhGxC025992 for ; Tue, 1 Sep 2009 17:43:17 -0400 Message-ID: <4A9D9574.3010606@redhat.com> Date: Tue, 01 Sep 2009 16:43:16 -0500 From: Eric Sandeen User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: ext4 development Subject: [PATCH] libext2fs: use ext2fs_blocks_count() in ext2fs_open2() X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org ext2fs_open2() was only looking at s_blocks_count, and when it wrapped to a low number, it was failing the test of: fs->super->s_first_data_block >= fs->super->s_blocks_count which made the superblock look corrupt. Signed-off-by: Eric Sandeen --- Patch is against the pu branch -- 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 Index: e2fsprogs/lib/ext2fs/openfs.c =================================================================== --- e2fsprogs.orig/lib/ext2fs/openfs.c +++ e2fsprogs/lib/ext2fs/openfs.c @@ -288,7 +288,7 @@ errcode_t ext2fs_open2(const char *name, blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(fs->super) || fs->inode_blocks_per_group > EXT2_MAX_INODES_PER_GROUP(fs->super) || EXT2_DESC_PER_BLOCK(fs->super) == 0 || - fs->super->s_first_data_block >= fs->super->s_blocks_count) { + fs->super->s_first_data_block >= ext2fs_blocks_count(fs->super)) { retval = EXT2_ET_CORRUPT_SUPERBLOCK; goto cleanup; }