ext3: fix chain verification in ext3_get_blocks()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, June 18, 2009 - 2:59 pm

Gitweb:     http://git.kernel.org/linus/e8ef7aaea79a899be4d7f50e829900c0ce15e52f
Commit:     e8ef7aaea79a899be4d7f50e829900c0ce15e52f
Parent:     ce05b2a9db1d86635a906f14427deff97eeb6183
Author:     Jan Kara <jack@suse.cz>
AuthorDate: Wed Jun 17 16:26:23 2009 -0700
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Thu Jun 18 13:03:45 2009 -0700

    ext3: fix chain verification in ext3_get_blocks()
    
    Chain verification in ext3_get_blocks() has been hosed since it called
    verify_chain(chain, NULL) which always returns success.  As a result
    readers could in theory race with truncate.  On the other hand the race
    probably cannot happen with the current locking scheme, since by the
    time ext3_truncate() is called all the pages are already removed and
    hence get_block() shouldn't be called on such pages...
    
    Signed-off-by: Jan Kara <jack@suse.cz>
    Cc: <linux-ext4@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 fs/ext3/inode.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index b0248c6..253c2cd 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -820,7 +820,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
 		while (count < maxblocks && count <= blocks_to_boundary) {
 			ext3_fsblk_t blk;
 
-			if (!verify_chain(chain, partial)) {
+			if (!verify_chain(chain, chain + depth - 1)) {
 				/*
 				 * Indirect block might be removed by
 				 * truncate while we were reading it.
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ext3: fix chain verification in ext3_get_blocks(), Linux Kernel Mailing ..., (Thu Jun 18, 2:59 pm)