From: Eric Sandeen Date: Wed, 3 Jan 2018 19:42:03 +0000 (-0600) Subject: xfs: fix leaks on corruption errors in xfs_bmap.c X-Git-Tag: v4.15.0-rc1~79^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5c40ca1fbca9c7b67b775b38063951e21308aebd;p=thirdparty%2Fxfsprogs-dev.git xfs: fix leaks on corruption errors in xfs_bmap.c Source kernel commit: d41c6172bd4031979eab722c265a2e5764383c3c Use _GOTO instead of _RETURN so we can free the allocated cursor on error. Fixes: bf80628 ("xfs: remove xfs_bmse_shift_one") Fixes-coverity-id: 1423813, 1423676 Signed-off-by: Eric Sandeen Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 195f0fb14..50c3d112f 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -5653,7 +5653,8 @@ xfs_bmap_collapse_extents( *done = true; goto del_cursor; } - XFS_WANT_CORRUPTED_RETURN(mp, !isnullstartblock(got.br_startblock)); + XFS_WANT_CORRUPTED_GOTO(mp, !isnullstartblock(got.br_startblock), + del_cursor); new_startoff = got.br_startoff - offset_shift_fsb; if (xfs_iext_peek_prev_extent(ifp, &icur, &prev)) { @@ -5758,7 +5759,8 @@ xfs_bmap_insert_extents( goto del_cursor; } } - XFS_WANT_CORRUPTED_RETURN(mp, !isnullstartblock(got.br_startblock)); + XFS_WANT_CORRUPTED_GOTO(mp, !isnullstartblock(got.br_startblock), + del_cursor); if (stop_fsb >= got.br_startoff + got.br_blockcount) { error = -EIO;