From: Jan Kara Date: Wed, 17 Jun 2009 23:26:23 +0000 (-0700) Subject: ext3: fix chain verification in ext3_get_blocks() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e8ef7aaea79a899be4d7f50e829900c0ce15e52f;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index b0248c6d5d4c..253c2cdc8d04 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.