diff options
author | Eric Sandeen <sandeen@sandeen.net> | 2015-02-24 10:15:18 +1100 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2015-02-24 10:15:18 +1100 |
commit | 83d5f01858b56db69c8e4ca5389ef7c29bfdb5dd (patch) | |
tree | 37df1f495145231bb6ac5ca8de571849ae0c1aa8 /fs/xfs | |
parent | fc921566f4fcf4499e9a6d010391c00be199ab85 (diff) | |
download | linux-stable-83d5f01858b56db69c8e4ca5389ef7c29bfdb5dd.tar.gz linux-stable-83d5f01858b56db69c8e4ca5389ef7c29bfdb5dd.tar.bz2 linux-stable-83d5f01858b56db69c8e4ca5389ef7c29bfdb5dd.zip |
xfs: cancel failed transaction in xfs_fs_commit_blocks()
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@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_pnfs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c index 4b33ef112400..365dd57ea760 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); |