]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: fix leaks on corruption errors in xfs_bmap.c
authorEric Sandeen <sandeen@sandeen.net>
Wed, 3 Jan 2018 19:42:03 +0000 (13:42 -0600)
committerEric Sandeen <sandeen@redhat.com>
Wed, 3 Jan 2018 19:42:03 +0000 (13:42 -0600)
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: 14238131423676
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_bmap.c

index 195f0fb14d7062d4b397b4a3c8669d72afcb2c15..50c3d112fffa52e50137f8fba3c83f360e524d38 100644 (file)
@@ -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;