Btrfs: fix memory leak in btrfs_ioctl_start_sync()
Call btrfs_end_transaction() if btrfs_commit_transaction_async() fails. Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
b44c59a80d
commit
8b2b2d3cbe
|
@ -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)))
|
||||||
|
|
Loading…
Reference in New Issue