aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2011-08-28 21:25:53 -0400
committerDavid Sterba <dsterba@suse.cz>2011-10-20 12:10:31 -0400
commit84850e8d8a5ec7b9d3c47d224e9a10c9da52ff1b (patch)
tree799dd9e0b150361dc2a5cdf3772a0ce8395d5f06
parent016fc6a63e465d5b94e4028f6d05d9703e195428 (diff)
btrfs: check file extent backref offset underflow
Offset field in data extent backref can underflow if clone range ioctl is used. We can reliably detect the underflow because max file size is limited to 2^63 and max data extent size is limited by block group size. Signed-off-by: Zheng Yan <zheng.z.yan@intel.com>
-rw-r--r--fs/btrfs/relocation.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 10af6a0e0865..24d654ce7a06 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -3322,8 +3322,11 @@ static int find_data_references(struct reloc_control *rc,
3322 } 3322 }
3323 3323
3324 key.objectid = ref_objectid; 3324 key.objectid = ref_objectid;
3325 key.offset = ref_offset;
3326 key.type = BTRFS_EXTENT_DATA_KEY; 3325 key.type = BTRFS_EXTENT_DATA_KEY;
3326 if (ref_offset > ((u64)-1 << 32))
3327 key.offset = 0;
3328 else
3329 key.offset = ref_offset;
3327 3330
3328 path->search_commit_root = 1; 3331 path->search_commit_root = 1;
3329 path->skip_locking = 1; 3332 path->skip_locking = 1;