From: Liu Bo Date: Wed, 1 May 2013 16:23:41 +0000 (+0000) Subject: Btrfs: fix off-by-one in fiemap X-Git-Tag: submit/tizen_common/20140905.094502~2561^2~86^2~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a52f4cd2b1a863a42c1cb268b1cddad451cdfede;p=sdk%2Femulator%2Femulator-kernel.git Btrfs: fix off-by-one in fiemap lock_extent/unlock_extent expect an exclusive end. Tested-by: David Sterba Signed-off-by: Liu Bo Signed-off-by: Josef Bacik --- diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index d2ac518..3e6e410 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3989,7 +3989,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, last_for_get_extent = isize; } - lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, + lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len - 1, 0, &cached_state); em = get_extent_skip_holes(inode, start, last_for_get_extent, @@ -4076,7 +4076,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, out_free: free_extent_map(em); out: - unlock_extent_cached(&BTRFS_I(inode)->io_tree, start, start + len, + unlock_extent_cached(&BTRFS_I(inode)->io_tree, start, start + len - 1, &cached_state, GFP_NOFS); return ret; }