linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libext2fs: use ext2fs_blocks_count() in ext2fs_open2()
@ 2009-09-01 21:43 Eric Sandeen
  2009-09-02  5:59 ` Andreas Dilger
  2009-09-06 16:30 ` [PATCH] libext2fs: use ext2fs_blocks_count() in ext2fs_open2() Theodore Tso
  0 siblings, 2 replies; 19+ messages in thread
From: Eric Sandeen @ 2009-09-01 21:43 UTC (permalink / raw)
  To: ext4 development

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 <sandeen@redhat.com>
---

Patch is against the pu branch

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


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2009-09-06 18:19 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-01 21:43 [PATCH] libext2fs: use ext2fs_blocks_count() in ext2fs_open2() Eric Sandeen
2009-09-02  5:59 ` Andreas Dilger
2009-09-02  6:05   ` Justin Maggard
2009-09-02 16:43     ` Eric Sandeen
2009-09-02 21:02       ` Nick Dokos
2009-09-02 21:28         ` Justin Maggard
2009-09-02 21:31           ` Eric Sandeen
2009-09-02 21:37           ` Nick Dokos
2009-09-02 21:43             ` Eric Sandeen
2009-09-02 21:45               ` Justin Maggard
2009-09-02 22:33                 ` Eric Sandeen
2009-09-02 22:55                   ` Andreas Dilger
2009-09-03  2:41                     ` Eric Sandeen
2009-09-02 22:28         ` Theodore Tso
2009-09-02 23:12           ` Nick Dokos
2009-09-06 16:37         ` [PATCH] Fix counting routines in blknum.c to take/return __u32 counts Theodore Tso
2009-09-06 17:41           ` Nick Dokos
2009-09-06 18:19             ` Theodore Tso
2009-09-06 16:30 ` [PATCH] libext2fs: use ext2fs_blocks_count() in ext2fs_open2() Theodore Tso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).