summaryrefslogtreecommitdiff
path: root/fs/btrfs/send.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2024-02-07 00:47:13 +0300
committerDavid Sterba <dsterba@suse.com>2024-03-04 18:24:51 +0300
commit3c6ee34c6f9cd12802326da26631232a61743501 (patch)
treeffeadcb64cc581d13e46b5ed470caddf7a59c979 /fs/btrfs/send.c
parent5d2288711ccc483feca73151c46ee835bda17839 (diff)
downloadlinux-3c6ee34c6f9cd12802326da26631232a61743501.tar.xz
btrfs: send: handle path ref underflow in header iterate_inode_ref()
Change BUG_ON to proper error handling if building the path buffer fails. The pointers are not printed so we don't accidentally leak kernel addresses. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r--fs/btrfs/send.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 3b3f38a76b00..5b7ec4f99aad 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1074,7 +1074,15 @@ static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path,
ret = PTR_ERR(start);
goto out;
}
- BUG_ON(start < p->buf);
+ if (unlikely(start < p->buf)) {
+ btrfs_err(root->fs_info,
+ "send: path ref buffer underflow for key (%llu %u %llu)",
+ found_key->objectid,
+ found_key->type,
+ found_key->offset);
+ ret = -EINVAL;
+ goto out;
+ }
}
p->start = start;
} else {