mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 03:50:53 +07:00
Btrfs: make sure roots are assigned before freeing their nodes
If we fail to load the chunk tree we'll call free_root_pointers, except we may not have assigned the roots for the dev_root/extent_root/csum_root yet, so we could NULL pointer deref at this point. Just add checks to make sure these roots are set to keep us from panicing. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
This commit is contained in:
parent
3a6cad9009
commit
655b09fe54
@ -1987,30 +1987,33 @@ static void free_root_pointers(struct btrfs_fs_info *info, int chunk_root)
|
||||
{
|
||||
free_extent_buffer(info->tree_root->node);
|
||||
free_extent_buffer(info->tree_root->commit_root);
|
||||
free_extent_buffer(info->dev_root->node);
|
||||
free_extent_buffer(info->dev_root->commit_root);
|
||||
free_extent_buffer(info->extent_root->node);
|
||||
free_extent_buffer(info->extent_root->commit_root);
|
||||
free_extent_buffer(info->csum_root->node);
|
||||
free_extent_buffer(info->csum_root->commit_root);
|
||||
info->tree_root->node = NULL;
|
||||
info->tree_root->commit_root = NULL;
|
||||
|
||||
if (info->dev_root) {
|
||||
free_extent_buffer(info->dev_root->node);
|
||||
free_extent_buffer(info->dev_root->commit_root);
|
||||
info->dev_root->node = NULL;
|
||||
info->dev_root->commit_root = NULL;
|
||||
}
|
||||
if (info->extent_root) {
|
||||
free_extent_buffer(info->extent_root->node);
|
||||
free_extent_buffer(info->extent_root->commit_root);
|
||||
info->extent_root->node = NULL;
|
||||
info->extent_root->commit_root = NULL;
|
||||
}
|
||||
if (info->csum_root) {
|
||||
free_extent_buffer(info->csum_root->node);
|
||||
free_extent_buffer(info->csum_root->commit_root);
|
||||
info->csum_root->node = NULL;
|
||||
info->csum_root->commit_root = NULL;
|
||||
}
|
||||
if (info->quota_root) {
|
||||
free_extent_buffer(info->quota_root->node);
|
||||
free_extent_buffer(info->quota_root->commit_root);
|
||||
}
|
||||
|
||||
info->tree_root->node = NULL;
|
||||
info->tree_root->commit_root = NULL;
|
||||
info->dev_root->node = NULL;
|
||||
info->dev_root->commit_root = NULL;
|
||||
info->extent_root->node = NULL;
|
||||
info->extent_root->commit_root = NULL;
|
||||
info->csum_root->node = NULL;
|
||||
info->csum_root->commit_root = NULL;
|
||||
if (info->quota_root) {
|
||||
info->quota_root->node = NULL;
|
||||
info->quota_root->commit_root = NULL;
|
||||
}
|
||||
|
||||
if (chunk_root) {
|
||||
free_extent_buffer(info->chunk_root->node);
|
||||
free_extent_buffer(info->chunk_root->commit_root);
|
||||
|
Loading…
Reference in New Issue
Block a user