linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH e2fsprogs] fix test in ext2fs_check_desc() for inode table within block group
@ 2007-07-20 21:50 Eric Sandeen
  2007-07-20 22:04 ` Eric Sandeen
  2007-07-22 20:01 ` Theodore Tso
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2007-07-20 21:50 UTC (permalink / raw)
  To: ext4 development

The test in ext2fs_check_desc() is off by one; if the inode table
goes all the way to the last block of the block group, it will 
falsely assert that it has extended past it.  The last block
of a range is start + len -1, not start + len.

Testcase to follow.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Index: e2fsprogs-1.40.2/lib/ext2fs/check_desc.c
===================================================================
--- e2fsprogs-1.40.2.orig/lib/ext2fs/check_desc.c
+++ e2fsprogs-1.40.2/lib/ext2fs/check_desc.c
@@ -61,7 +61,7 @@ errcode_t ext2fs_check_desc(ext2_filsys 
 		 */
 		if (fs->group_desc[i].bg_inode_table < first_block ||
 		    ((fs->group_desc[i].bg_inode_table +
-		      fs->inode_blocks_per_group) > last_block))
+		      fs->inode_blocks_per_group - 1) > last_block))
 			return EXT2_ET_GDESC_BAD_INODE_TABLE;
 	}
 	return 0;

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

* Re: [PATCH e2fsprogs] fix test in ext2fs_check_desc() for inode table within block group
  2007-07-20 21:50 [PATCH e2fsprogs] fix test in ext2fs_check_desc() for inode table within block group Eric Sandeen
@ 2007-07-20 22:04 ` Eric Sandeen
  2007-07-22 20:01 ` Theodore Tso
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2007-07-20 22:04 UTC (permalink / raw)
  To: ext4 development

Eric Sandeen wrote:
> The test in ext2fs_check_desc() is off by one; if the inode table
> goes all the way to the last block of the block group, it will 
> falsely assert that it has extended past it.  The last block
> of a range is start + len -1, not start + len.
> 
(btw the kernel has this same problem, so it's not mountable either -
will send that patch Monday)

-Eric

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

* Re: [PATCH e2fsprogs] fix test in ext2fs_check_desc() for inode table within block group
  2007-07-20 21:50 [PATCH e2fsprogs] fix test in ext2fs_check_desc() for inode table within block group Eric Sandeen
  2007-07-20 22:04 ` Eric Sandeen
@ 2007-07-22 20:01 ` Theodore Tso
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Tso @ 2007-07-22 20:01 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: ext4 development

On Fri, Jul 20, 2007 at 04:50:26PM -0500, Eric Sandeen wrote:
> The test in ext2fs_check_desc() is off by one; if the inode table
> goes all the way to the last block of the block group, it will 
> falsely assert that it has extended past it.  The last block
> of a range is start + len -1, not start + len.

Thanks, committed into git (combined with the test case) and updated
commit log to include the Red Hat Bugzilla number.

						- Ted

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

end of thread, other threads:[~2007-07-22 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-20 21:50 [PATCH e2fsprogs] fix test in ext2fs_check_desc() for inode table within block group Eric Sandeen
2007-07-20 22:04 ` Eric Sandeen
2007-07-22 20:01 ` 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).