All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: fix some memory leaks in log recovery
@ 2019-11-14 21:11 Darrick J. Wong
  2019-11-15 11:40 ` Brian Foster
  0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2019-11-14 21:11 UTC (permalink / raw)
  To: xfs

From: Darrick J. Wong <darrick.wong@oracle.com>

Fix a few places where we xlog_alloc_buffer a buffer, hit an error, and
then bail out without freeing the buffer.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_log_recover.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index f64614c3c13e..165f5181d02d 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -1342,10 +1342,11 @@ xlog_find_tail(
 	error = xlog_rseek_logrec_hdr(log, *head_blk, *head_blk, 1, buffer,
 				      &rhead_blk, &rhead, &wrapped);
 	if (error < 0)
-		return error;
+		goto done;
 	if (!error) {
 		xfs_warn(log->l_mp, "%s: couldn't find sync record", __func__);
-		return -EFSCORRUPTED;
+		error = -EFSCORRUPTED;
+		goto done;
 	}
 	*tail_blk = BLOCK_LSN(be64_to_cpu(rhead->h_tail_lsn));
 
@@ -5300,7 +5301,8 @@ xlog_do_recovery_pass(
 			} else {
 				XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
 						log->l_mp);
-				return -EFSCORRUPTED;
+				error = -EFSCORRUPTED;
+				goto bread_err1;
 			}
 		}
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: fix some memory leaks in log recovery
  2019-11-14 21:11 [PATCH] xfs: fix some memory leaks in log recovery Darrick J. Wong
@ 2019-11-15 11:40 ` Brian Foster
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Foster @ 2019-11-15 11:40 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: xfs

On Thu, Nov 14, 2019 at 01:11:10PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Fix a few places where we xlog_alloc_buffer a buffer, hit an error, and
> then bail out without freeing the buffer.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_log_recover.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index f64614c3c13e..165f5181d02d 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -1342,10 +1342,11 @@ xlog_find_tail(
>  	error = xlog_rseek_logrec_hdr(log, *head_blk, *head_blk, 1, buffer,
>  				      &rhead_blk, &rhead, &wrapped);
>  	if (error < 0)
> -		return error;
> +		goto done;
>  	if (!error) {
>  		xfs_warn(log->l_mp, "%s: couldn't find sync record", __func__);
> -		return -EFSCORRUPTED;
> +		error = -EFSCORRUPTED;
> +		goto done;
>  	}
>  	*tail_blk = BLOCK_LSN(be64_to_cpu(rhead->h_tail_lsn));
>  
> @@ -5300,7 +5301,8 @@ xlog_do_recovery_pass(
>  			} else {
>  				XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
>  						log->l_mp);
> -				return -EFSCORRUPTED;
> +				error = -EFSCORRUPTED;
> +				goto bread_err1;
>  			}
>  		}
>  
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-15 11:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 21:11 [PATCH] xfs: fix some memory leaks in log recovery Darrick J. Wong
2019-11-15 11:40 ` Brian Foster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.