Commit 8b2b2d3c authored by Tsutomu Itoh's avatar Tsutomu Itoh Committed by Chris Mason

Btrfs: fix memory leak in btrfs_ioctl_start_sync()

Call btrfs_end_transaction() if btrfs_commit_transaction_async() fails.
Signed-off-by: default avatarTsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent b44c59a8
...@@ -2436,8 +2436,10 @@ static noinline long btrfs_ioctl_start_sync(struct file *file, void __user *argp ...@@ -2436,8 +2436,10 @@ static noinline long btrfs_ioctl_start_sync(struct file *file, void __user *argp
return PTR_ERR(trans); return PTR_ERR(trans);
transid = trans->transid; transid = trans->transid;
ret = btrfs_commit_transaction_async(trans, root, 0); ret = btrfs_commit_transaction_async(trans, root, 0);
if (ret) if (ret) {
btrfs_end_transaction(trans, root);
return ret; return ret;
}
if (argp) if (argp)
if (copy_to_user(argp, &transid, sizeof(transid))) if (copy_to_user(argp, &transid, sizeof(transid)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment