mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-26 06:33:19 -04:00
Btrfs: fix a double free on pending snapshots in error handling
When creating a snapshot, failing to commit a transaction can end up with aborting the transaction, following by doing a cleanup for it, where we'll free all snapshots pending to disk. So we check it and avoid double free on pending snapshots. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
parent
37c4146d22
commit
109f2365f1
1 changed files with 5 additions and 1 deletions
|
|
@ -571,8 +571,12 @@ static int create_snapshot(struct btrfs_root *root, struct dentry *dentry,
|
|||
ret = btrfs_commit_transaction(trans,
|
||||
root->fs_info->extent_root);
|
||||
}
|
||||
if (ret)
|
||||
if (ret) {
|
||||
/* cleanup_transaction has freed this for us */
|
||||
if (trans->aborted)
|
||||
pending_snapshot = NULL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = pending_snapshot->error;
|
||||
if (ret)
|
||||
|
|
|
|||
Loading…
Reference in a new issue