* [PATCH] xfs: fix leaks on corruption errors in xfs_bmap.c
@ 2017-11-27 22:48 Eric Sandeen
2017-11-27 22:49 ` Eric Sandeen
2017-11-28 2:21 ` Darrick J. Wong
0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2017-11-27 22:48 UTC (permalink / raw)
To: linux-xfs
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
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
Compile-tested only
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 08df809..87884aa 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -5662,7 +5662,8 @@ static inline bool xfs_bmap_wants_extents(struct xfs_inode *ip, int whichfork)
*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)) {
@@ -5767,7 +5768,8 @@ static inline bool xfs_bmap_wants_extents(struct xfs_inode *ip, int whichfork)
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;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: fix leaks on corruption errors in xfs_bmap.c
2017-11-27 22:48 [PATCH] xfs: fix leaks on corruption errors in xfs_bmap.c Eric Sandeen
@ 2017-11-27 22:49 ` Eric Sandeen
2017-11-28 2:21 ` Darrick J. Wong
1 sibling, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2017-11-27 22:49 UTC (permalink / raw)
To: linux-xfs
On 11/27/17 4:48 PM, Eric Sandeen wrote:
> 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
also 1423676
-Eric
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> Compile-tested only
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: fix leaks on corruption errors in xfs_bmap.c
2017-11-27 22:48 [PATCH] xfs: fix leaks on corruption errors in xfs_bmap.c Eric Sandeen
2017-11-27 22:49 ` Eric Sandeen
@ 2017-11-28 2:21 ` Darrick J. Wong
1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2017-11-28 2:21 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-xfs
On Mon, Nov 27, 2017 at 04:48:02PM -0600, Eric Sandeen wrote:
> 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
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Looks ok, will test
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>
> Compile-tested only
>
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index 08df809..87884aa 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -5662,7 +5662,8 @@ static inline bool xfs_bmap_wants_extents(struct xfs_inode *ip, int whichfork)
> *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)) {
> @@ -5767,7 +5768,8 @@ static inline bool xfs_bmap_wants_extents(struct xfs_inode *ip, int whichfork)
> 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;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-28 2:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-27 22:48 [PATCH] xfs: fix leaks on corruption errors in xfs_bmap.c Eric Sandeen
2017-11-27 22:49 ` Eric Sandeen
2017-11-28 2:21 ` Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).