浏览代码

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>
Jan Kara 16 年之前
父节点
当前提交
e8ef7aaea7
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      fs/ext3/inode.c

+ 1 - 1
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) {
 		while (count < maxblocks && count <= blocks_to_boundary) {
 			ext3_fsblk_t blk;
 			ext3_fsblk_t blk;
 
 
-			if (!verify_chain(chain, partial)) {
+			if (!verify_chain(chain, chain + depth - 1)) {
 				/*
 				/*
 				 * Indirect block might be removed by
 				 * Indirect block might be removed by
 				 * truncate while we were reading it.
 				 * truncate while we were reading it.