Qu Wenruo @ 2026-11-24 07:07 +1030: > In handle_indirect_tree_backref(), if we got @cur->level set to 7 > (the max level valid), @level will be 8, then later path->slots[level] > and path->nodes[level] will all go beyond the array boundary. > > Fix it by rejecting such high level before calling btrfs_search_slot(). > > Link: https://sashiko.dev/#/bug/linux-8a4f92b4-daf7-4f57-8369-8e6ef323652f > Signed-off-by: Qu Wenruo > --- > fs/btrfs/backref.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c > index a0fb90b7a9ed..e9434e033372 100644 > --- a/fs/btrfs/backref.c > +++ b/fs/btrfs/backref.c > @@ -3316,6 +3316,11 @@ static int handle_indirect_tree_backref(struct btrfs_trans_handle *trans, > } > > level = cur->level + 1; > + if (unlikely(level >= BTRFS_MAX_LEVEL)) { > + btrfs_put_root(root); > + btrfs_err(fs_info, "invalid searcch level %d", level); Very minor, mind the typo in "search". > + return -EUCLEAN; > + } > > /* Search the tree to find parent blocks referring to the block */ > path->search_commit_root = true;