Skip to content

Commit

Permalink
14982 zfs: Fix use-after-free in btree code
Browse files Browse the repository at this point in the history
Reviewed by: Andy Stormont <andyjstormont@gmail.com>
Reviewed by: Gordon Ross <Gordon.W.Ross@gmail.com>
Reviewed by: Paul Zuchowski <p.zuchowski98@gmail.com>
Approved by: Dan McDonald <danmcd@mnx.io>
  • Loading branch information
ryao authored and tsoome committed Dec 2, 2022
1 parent 616aa2d commit d80dfda
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions usr/src/uts/common/fs/zfs/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1608,8 +1608,8 @@ zfs_btree_remove_from_node(zfs_btree_t *tree, zfs_btree_core_t *node,
zfs_btree_poison_node_at(tree, keep_hdr, keep_hdr->bth_count, 1);

new_rm_hdr->bth_count = 0;
zfs_btree_node_destroy(tree, new_rm_hdr);
zfs_btree_remove_from_node(tree, parent, new_rm_hdr);
zfs_btree_node_destroy(tree, new_rm_hdr);
}

/* Remove the element at the specific location. */
Expand Down Expand Up @@ -1817,10 +1817,10 @@ zfs_btree_remove_idx(zfs_btree_t *tree, zfs_btree_index_t *where)

/* Move our elements to the left neighbor. */
bt_transfer_leaf(tree, rm, 0, rm_hdr->bth_count, keep, k_count + 1);
zfs_btree_node_destroy(tree, rm_hdr);

/* Remove the emptied node from the parent. */
zfs_btree_remove_from_node(tree, parent, rm_hdr);
zfs_btree_node_destroy(tree, rm_hdr);
zfs_btree_verify(tree);
}

Expand Down

0 comments on commit d80dfda

Please sign in to comment.