aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-01 13:48:14 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:01 -0400
commit0999df54f850fe1aba29b10d5c869493af107478 (patch)
treec67e0ca38e89d0872f6246093d962ce598b49ec7 /fs/btrfs/extent-tree.c
parentecbe2402cb4e4e7413544dc392c1a78d0f290292 (diff)
Btrfs: Verify checksums on tree blocks found without read_tree_block
Checksums were only verified by btrfs_read_tree_block, which meant the functions to probe the page cache for blocks were not validating checksums. Normally this is fine because the buffers will only be in cache if they have already been validated. But, there is a window while the buffer is being read from disk where it could be up to date in the cache but not yet verified. This patch makes sure all buffers go through checksum verification before they are used. This is safer, and it prevents modification of buffers before they go through the csum code. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index cf283b0271a..a34c289aec2 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2069,6 +2069,8 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans,
2069 BUG_ON(ret); 2069 BUG_ON(ret);
2070 continue; 2070 continue;
2071 } 2071 }
2072 } else if (next) {
2073 btrfs_verify_block_csum(root, next);
2072 } 2074 }
2073 WARN_ON(*level <= 0); 2075 WARN_ON(*level <= 0);
2074 if (path->nodes[*level-1]) 2076 if (path->nodes[*level-1])