public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: tinguely@sgi.com
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: fix memory leak in xlog_recover_add_to_trans
Date: Fri, 27 Sep 2013 11:55:11 -0500	[thread overview]
Message-ID: <5245B86F.3030309@sandeen.net> (raw)
In-Reply-To: <20130927140104.515578025@sgi.com>

On 9/27/13 9:00 AM, tinguely@sgi.com wrote:
> Free the memory in error path of xlog_recover_add_to_trans().
> Normally this memory is freed in recovery pass2, but is leaked
> in the error path.
> 
> Signed-off-by: Mark Tinguely <tinguely@sgi.com>

For this local leak & the fix,

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

Since this gets called in a loop from xlog_recover_process_data(),
I'm wondering what happens to previously-allocated items, if we
return an error and never get to pass2?

(I could be off base, haven't really followed it through, but
it seems like they might leak).

Thanks,
-Eric

> ---
> Found by Coverity (134683) in userspace, same patch applies there
> also.
>  fs/xfs/xfs_log_recover.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> Index: b/fs/xfs/xfs_log_recover.c
> ===================================================================
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -1585,6 +1585,7 @@ xlog_recover_add_to_trans(
>  		"bad number of regions (%d) in inode log format",
>  				  in_f->ilf_size);
>  			ASSERT(0);
> +			free(ptr);
>  			return XFS_ERROR(EIO);
>  		}
>  
> 
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2013-09-27 16:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-27 14:00 [PATCH] xfs: fix memory leak in xlog_recover_add_to_trans tinguely
2013-09-27 16:55 ` Eric Sandeen [this message]
2013-09-27 17:34   ` Mark Tinguely
2013-09-27 17:35     ` Eric Sandeen
2013-09-30 22:53 ` Ben Myers
2013-10-01 13:20   ` Mark Tinguely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5245B86F.3030309@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=tinguely@sgi.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox