public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: <ntfs3@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] fs/ntfs3: Fix some memory leaks in an error handling path of 'log_replay()'
Date: Tue, 23 Nov 2021 18:47:28 +0300	[thread overview]
Message-ID: <8fe8f1fd-b6ca-a8be-b899-b93d855e7748@paragon-software.com> (raw)
In-Reply-To: <a2244abd11dc5f5ee8a0dcec97da33b75923facb.1636616693.git.christophe.jaillet@wanadoo.fr>



On 11.11.2021 10:45, Christophe JAILLET wrote:
> All error handling paths lead to 'out' where many resources are freed.
> 
> Do it as well here instead of a direct return, otherwise 'log', 'ra' and
> 'log->one_page_buf' (at least) will leak.
> 
> Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  fs/ntfs3/fslog.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
> index 06492f088d60..915f42cf07bc 100644
> --- a/fs/ntfs3/fslog.c
> +++ b/fs/ntfs3/fslog.c
> @@ -4085,8 +4085,10 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
>  		if (client == LFS_NO_CLIENT_LE) {
>  			/* Insert "NTFS" client LogFile. */
>  			client = ra->client_idx[0];
> -			if (client == LFS_NO_CLIENT_LE)
> -				return -EINVAL;
> +			if (client == LFS_NO_CLIENT_LE) {
> +				err = -EINVAL;
> +				goto out;
> +			}
>  
>  			t16 = le16_to_cpu(client);
>  			cr = ca + t16;
> 


Thanks for patch, applied!

      reply	other threads:[~2021-11-23 15:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11  7:45 [PATCH] fs/ntfs3: Fix some memory leaks in an error handling path of 'log_replay()' Christophe JAILLET
2021-11-23 15:47 ` Konstantin Komarov [this message]

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=8fe8f1fd-b6ca-a8be-b899-b93d855e7748@paragon-software.com \
    --to=almaz.alexandrovich@paragon-software.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    /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