Skip to content

Commit 08b096c

Browse files
adam900710kdave
authored andcommitted
btrfs: send: check for inline extents in range_is_hole_in_parent()
Before accessing the disk_bytenr field of a file extent item we need to check if we are dealing with an inline extent. This is because for inline extents their data starts at the offset of the disk_bytenr field. So accessing the disk_bytenr means we are accessing inline data or in case the inline data is less than 8 bytes we can actually cause an invalid memory access if this inline extent item is the first item in the leaf or access metadata from other items. Fixes: 82bfb2e ("Btrfs: incremental send, fix unnecessary hole writes for sparse files") Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent d5fac7d commit 08b096c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

fs/btrfs/send.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6382,6 +6382,8 @@ static int range_is_hole_in_parent(struct send_ctx *sctx,
63826382
extent_end = btrfs_file_extent_end(path);
63836383
if (extent_end <= start)
63846384
goto next;
6385+
if (btrfs_file_extent_type(leaf, fi) == BTRFS_FILE_EXTENT_INLINE)
6386+
return 0;
63856387
if (btrfs_file_extent_disk_bytenr(leaf, fi) == 0) {
63866388
search_start = extent_end;
63876389
goto next;

0 commit comments

Comments
 (0)