Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 024529c2 authored by David Sterba's avatar David Sterba Committed by Greg Kroah-Hartman
Browse files

btrfs: send: handle path ref underflow in header iterate_inode_ref()



[ 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: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent a9252c8c
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -973,7 +973,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 {