Skip to content

Commit 9d6cbd4

Browse files
kdavesmb49
authored andcommitted
btrfs: send: handle path ref underflow in header iterate_inode_ref()
BugLink: https://bugs.launchpad.net/bugs/2065899 [ Upstream commit 3c6ee34c6f9cd12802326da26631232a61743501 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
1 parent 8cac96b commit 9d6cbd4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

fs/btrfs/send.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,15 @@ static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path,
10701070
ret = PTR_ERR(start);
10711071
goto out;
10721072
}
1073-
BUG_ON(start < p->buf);
1073+
if (unlikely(start < p->buf)) {
1074+
btrfs_err(root->fs_info,
1075+
"send: path ref buffer underflow for key (%llu %u %llu)",
1076+
found_key->objectid,
1077+
found_key->type,
1078+
found_key->offset);
1079+
ret = -EINVAL;
1080+
goto out;
1081+
}
10741082
}
10751083
p->start = start;
10761084
} else {

0 commit comments

Comments
 (0)