Commit 3c6ee34c authored by David Sterba's avatar David Sterba

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: default avatarDavid Sterba <dsterba@suse.com>
parent 5d228871
...@@ -1074,7 +1074,15 @@ static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path, ...@@ -1074,7 +1074,15 @@ static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path,
ret = PTR_ERR(start); ret = PTR_ERR(start);
goto out; 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; p->start = start;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment