mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-12 01:20:14 +00:00
Revert "btrfs: add ASSERTs on prealloc in qgroup functions"
This reverts commit 252877a8701530fde861a4f27710c1e718e97caa.
Commit 252877a87015 ("btrfs: add ASSERTs on prealloc in qgroup
functions") tries to remove the kfree() on preallocated qgroup during
several call sites, but this cannot work as intended:
- btrfs_quota_enable()
- btrfs_create_qgroup()
If add_qgroup_item() failed, we go out_free_path() and at that time
prealloc is not yet utilized and will trigger the new ASSERT().
- btrfs_qgroup_inherit()
If qgroup_auto_inherit() failed, prealloc is not yet utilized and
will trigger the new ASSERT()
Reported-by: syzbot+b44d4a4885bc82af2a06@syzkaller.appspotmail.com
Link: https://lore.kernel.org/linux-btrfs/69369331.a70a0220.38f243.009e.GAE@google.com/
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
5630f7557d
commit
428e1b114c
@ -1243,14 +1243,7 @@ out:
|
||||
btrfs_end_transaction(trans);
|
||||
else if (trans)
|
||||
ret = btrfs_end_transaction(trans);
|
||||
|
||||
/*
|
||||
* At this point we either failed at allocating prealloc, or we
|
||||
* succeeded and passed the ownership to it to add_qgroup_rb(). In any
|
||||
* case, this needs to be NULL or there is something wrong.
|
||||
*/
|
||||
ASSERT(prealloc == NULL);
|
||||
|
||||
kfree(prealloc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1682,12 +1675,7 @@ int btrfs_create_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
|
||||
ret = btrfs_sysfs_add_one_qgroup(fs_info, qgroup);
|
||||
out:
|
||||
mutex_unlock(&fs_info->qgroup_ioctl_lock);
|
||||
/*
|
||||
* At this point we either failed at allocating prealloc, or we
|
||||
* succeeded and passed the ownership to it to add_qgroup_rb(). In any
|
||||
* case, this needs to be NULL or there is something wrong.
|
||||
*/
|
||||
ASSERT(prealloc == NULL);
|
||||
kfree(prealloc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3279,7 +3267,7 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid,
|
||||
struct btrfs_root *quota_root;
|
||||
struct btrfs_qgroup *srcgroup;
|
||||
struct btrfs_qgroup *dstgroup;
|
||||
struct btrfs_qgroup *prealloc = NULL;
|
||||
struct btrfs_qgroup *prealloc;
|
||||
struct btrfs_qgroup_list **qlist_prealloc = NULL;
|
||||
bool free_inherit = false;
|
||||
bool need_rescan = false;
|
||||
@ -3520,14 +3508,7 @@ out:
|
||||
}
|
||||
if (free_inherit)
|
||||
kfree(inherit);
|
||||
|
||||
/*
|
||||
* At this point we either failed at allocating prealloc, or we
|
||||
* succeeded and passed the ownership to it to add_qgroup_rb(). In any
|
||||
* case, this needs to be NULL or there is something wrong.
|
||||
*/
|
||||
ASSERT(prealloc == NULL);
|
||||
|
||||
kfree(prealloc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user