]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - fs/btrfs/ioctl.c
Btrfs: fix a double free on pending snapshots in error handling
[~shefty/rdma-dev.git] / fs / btrfs / ioctl.c
index 14c0d2e0790c95a8c2814fdfb4506939b5f2f765..e262cd8c4a7d9132880ab75ad5ca4adf63f86f20 100644 (file)
@@ -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)