Skip to content

Commit

Permalink
btrfs: send: handle path ref underflow in header iterate_inode_ref()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kdave committed Mar 4, 2024
1 parent 5d22887 commit 3c6ee34
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fs/btrfs/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3c6ee34

Please sign in to comment.