Commit d41c6172 authored by Eric Sandeen's avatar Eric Sandeen Committed by Darrick J. Wong

xfs: fix leaks on corruption errors in xfs_bmap.c

Use _GOTO instead of _RETURN so we can free the allocated
cursor on error.

Fixes: bf806280 ("xfs: remove xfs_bmse_shift_one")
Fixes-coverity-id: 1423813, 1423676
Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent d210a987
...@@ -5662,7 +5662,8 @@ xfs_bmap_collapse_extents( ...@@ -5662,7 +5662,8 @@ xfs_bmap_collapse_extents(
*done = true; *done = true;
goto del_cursor; 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; new_startoff = got.br_startoff - offset_shift_fsb;
if (xfs_iext_peek_prev_extent(ifp, &icur, &prev)) { if (xfs_iext_peek_prev_extent(ifp, &icur, &prev)) {
...@@ -5767,7 +5768,8 @@ xfs_bmap_insert_extents( ...@@ -5767,7 +5768,8 @@ xfs_bmap_insert_extents(
goto del_cursor; 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) { if (stop_fsb >= got.br_startoff + got.br_blockcount) {
error = -EIO; error = -EIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment