Message ID | 49BEA2FA.5070703@ph.tum.de |
---|---|
State | Rejected, archived |
Headers | show |
On Mon, Mar 16, 2009 at 08:05:30PM +0100, Thiemo Nagel wrote: > Thiemo Nagel wrote: >> >> Based on 2.6.29-rc7 with Aneesh Kumar's patches: >> ext4: Validate extent details only when read from the disk >> ext4: Add checks to validate extent entries >> >> Sets need_to_validate=0 inside instead of outside the loop. > > OTOH, why not remove the variable altogether? (cf. attached patch) This patch causes ext4_ext_check to be called before the variables eh is set, and before variable is updated. - Ted -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
--- linux-2.6.29-rc8/fs/ext4/extents.c~ 2009-03-16 19:37:22.000000000 +0100 +++ linux-2.6.29-rc8/fs/ext4/extents.c 2009-03-16 19:50:33.000000000 +0100 @@ -607,7 +607,6 @@ ext4_ext_find_extent(struct inode *inode, ext4_lblk_t block, struct ext4_ext_path *path) { - int need_to_validate = 0; struct ext4_extent_header *eh; struct buffer_head *bh; short int depth, i, ppos = 0, alloc = 0; @@ -646,17 +645,16 @@ goto err; } /* validate the extent entries */ - need_to_validate = 1; + if (ext4_ext_check(inode, eh, i)) + goto err; } + eh = ext_block_hdr(bh); ppos++; BUG_ON(ppos > depth); path[ppos].p_bh = bh; path[ppos].p_hdr = eh; i--; - - if (need_to_validate && ext4_ext_check(inode, eh, i)) - goto err; } path[ppos].p_depth = i;