From: Brian Foster Date: Mon, 15 Feb 2016 01:13:38 +0000 (+1100) Subject: xfs: add missing bmap cancel calls in error paths X-Git-Tag: v4.5.0-rc1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5769a376f40e73cba253189731d03c076a752603;p=thirdparty%2Fxfsprogs-dev.git xfs: add missing bmap cancel calls in error paths Source kernel commit d4a97a04227d5ba91b91888a016e2300861cfbc7 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 Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index aef7cf320..b9e58e271 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -5938,6 +5938,7 @@ xfs_bmap_split_extent( return xfs_trans_commit(tp); out: + xfs_bmap_cancel(&free_list); xfs_trans_cancel(tp); return error; }