summaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2015-08-19 02:01:40 +0200
committerDave Chinner <david@fromorbit.com>2015-08-19 02:01:40 +0200
commitd4a97a04227d5ba91b91888a016e2300861cfbc7 (patch)
tree3f320428898455bdd353f54ef4d8ff65b8786b82 /fs/xfs/libxfs
parentxfs: add helper to conditionally remove items from the AIL (diff)
downloadlinux-d4a97a04227d5ba91b91888a016e2300861cfbc7.tar.xz
linux-d4a97a04227d5ba91b91888a016e2300861cfbc7.zip
xfs: add missing bmap cancel calls in error paths
If a failure occurs after the bmap free list is populated and before xfs_bmap_finish() completes successfully (which returns a partial list on failure), the bmap free list must be cancelled. Otherwise, the extent items on the list are never freed and a memory leak occurs. Several random error paths throughout the code suffer this problem. Fix these up such that xfs_bmap_cancel() is always called on error. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/libxfs')
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 63e05b663380..8e2010d53b07 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -5945,6 +5945,7 @@ xfs_bmap_split_extent(
return xfs_trans_commit(tp);
out:
+ xfs_bmap_cancel(&free_list);
xfs_trans_cancel(tp);
return error;
}