mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-31 04:45:39 +01:00
Fix use-after-free in btree code
Coverty static analysis found these.
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Neal Gompa <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #10989
Closes #13861
Approved by: so
Security: FreeBSD-EN-22:21.zfs
(cherry picked from commit 8131a96544)
This commit is contained in:
1 parent
1ee7e4ba70
commit
8838c650cb
1 file changed
+2
-1
@@ -1536,8 +1536,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);
|
||||
|
||||
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. */
|
||||
@@ -1769,6 +1769,7 @@ zfs_btree_remove_idx(zfs_btree_t *tree, zfs_btree_index_t *where)
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user