]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: send: check for inline extents in range_is_hole_in_parent()
authorQu Wenruo <wqu@suse.com>
Tue, 6 Jan 2026 09:56:40 +0000 (20:26 +1030)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Jan 2026 10:21:15 +0000 (11:21 +0100)
commit39f83f10772310ba4a77f2b5256aaf36994ef7e8
tree0c2d277457b17e37b20185a9df4dc326ea2f130b
parent65241e3ddda60b53a4ee3ae12721fc9ee21d5827
btrfs: send: check for inline extents in range_is_hole_in_parent()

[ Upstream commit 08b096c1372cd69627f4f559fb47c9fb67a52b39 ]

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: 82bfb2e7b645 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/send.c