| To: | xfs-oss <xfs@xxxxxxxxxxx> |
|---|---|
| Subject: | [PATCH 2/2] xfs: cancel failed transaction in xfs_fs_commit_blocks() |
| From: | Eric Sandeen <sandeen@xxxxxxxxxxx> |
| Date: | Mon, 23 Feb 2015 13:00:27 -0600 |
| Cc: | Christoph Hellwig <hch@xxxxxx> |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <54EB782F.8020201@xxxxxxxxxx> |
| References: | <54EB782F.8020201@xxxxxxxxxx> |
If xfs_trans_reserve fails we don't cancel the transaction,
and we'll leak the allocated transaction pointer.
Spotted by Coverity.
Signed-off-by: Eric Sandeen <ssandeen@xxxxxxxxxx>
---
diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c
index 4b33ef1..365dd57 100644
--- a/fs/xfs/xfs_pnfs.c
+++ b/fs/xfs/xfs_pnfs.c
@@ -300,8 +300,10 @@ xfs_fs_commit_blocks(
tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0);
- if (error)
+ if (error) {
+ xfs_trans_cancel(tp, 0);
goto out_drop_iolock;
+ }
xfs_ilock(ip, XFS_ILOCK_EXCL);
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 1/2] xfs: Ensure we have target_ip for RENAME_EXCHANGE, Eric Sandeen |
|---|---|
| Next by Date: | [PATCH 0/2] xfs: minor kernel logging updates, Eric Sandeen |
| Previous by Thread: | Re: [PATCH 1/2] xfs: Ensure we have target_ip for RENAME_EXCHANGE, Christoph Hellwig |
| Next by Thread: | Re: [PATCH 2/2] xfs: cancel failed transaction in xfs_fs_commit_blocks(), Christoph Hellwig |
| Indexes: | [Date] [Thread] [Top] [All Lists] |