Skip to contentSkip to conversation

ext3: fix chain verification in ext3_get_blocks()

PATCH New [email protected] 1 participant 1 message Jun 17, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 29/133 ext3: fix chain verification in ext3_get_blocks()

From: Jan Kara <[email protected]>

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...

---

 fs/ext3/inode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext3/inode.c renamed from fs/ext3/inode.c~ext3-fix-chain-verification-in-ext3_get_blocks +1 -1
diff -puN fs/ext3/inode.c~ext3-fix-chain-verification-in-ext3_get_blocks fs/ext3/inode.c
@@ -820,7 +820,7 @@ int ext3_get_blocks_handle(handle_t *han
 		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.

_