[lvc-project] [PATCH 5.10] btrfs: send: check for inline extents in range_is_hole_in_parent()
Mikhail Dmitrichenko
mdmitrichenko at astralinux.ru
Tue Oct 13 17:41:13 MSK 2026
From: Qu Wenruo <wqu at suse.com>
commit 08b096c1372cd69627f4f559fb47c9fb67a52b39 upstream.
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 at suse.com>
Signed-off-by: Qu Wenruo <wqu at suse.com>
Reviewed-by: David Sterba <dsterba at suse.com>
Signed-off-by: David Sterba <dsterba at suse.com>
[ mdmitrichenko: use { ret = 0; goto out; } instead of returning
directly, since 5.10 has no automatic btrfs_path cleanup and the
early return would leak the path. ]
Signed-off-by: Mikhail Dmitrichenko <mdmitrichenko at astralinux.ru>
---
Backport fix for CVE-2026-23141
fs/btrfs/send.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index d86b4d13cae4..92018cd48e54 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -5892,6 +5892,10 @@ static int range_is_hole_in_parent(struct send_ctx *sctx,
extent_end = btrfs_file_extent_end(path);
if (extent_end <= start)
goto next;
+ if (btrfs_file_extent_type(leaf, fi) == BTRFS_FILE_EXTENT_INLINE) {
+ ret = 0;
+ goto out;
+ }
if (btrfs_file_extent_disk_bytenr(leaf, fi) == 0) {
search_start = extent_end;
goto next;
--
2.43.0
More information about the lvc-project
mailing list