linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <slava@dubeyko.com>
To: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
Cc: gustavoars@kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
	Linux FS Devel <linux-fsdevel@vger.kernel.org>,
	linux-kernel@vger.kernel.org, skhan@linuxfoundation.org,
	gregkh@linuxfoundation.org,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH 1/3] hfs: add missing clean-up in hfs_fill_super
Date: Tue, 29 Jun 2021 12:13:46 -0700	[thread overview]
Message-ID: <28CCF4E3-51D1-43BE-A2BA-4708175A59C0@dubeyko.com> (raw)
In-Reply-To: <20210629144803.62541-2-desmondcheongzx@gmail.com>



> On Jun 29, 2021, at 7:48 AM, Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com> wrote:
> 
> On exiting hfs_fill_super, the file descriptor used in hfs_find_init
> should be passed to hfs_find_exit to be cleaned up, and to release the
> lock held on the btree.
> 
> The call to hfs_find_exit is missing from this error path, so we add
> it in to release resources.
> 
> Signed-off-by: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> ---
> fs/hfs/super.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/fs/hfs/super.c b/fs/hfs/super.c
> index 44d07c9e3a7f..48340b77eb36 100644
> --- a/fs/hfs/super.c
> +++ b/fs/hfs/super.c
> @@ -419,6 +419,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
> 	res = hfs_cat_find_brec(sb, HFS_ROOT_CNID, &fd);
> 	if (!res) {
> 		if (fd.entrylength > sizeof(rec) || fd.entrylength < 0) {
> +			hfs_find_exit(&fd);

I see that there are several places of hfs_find_exit() calls in hfs_fill_super(). Maybe, it makes sense to move the hfs_find_exit() call to the end of the hfs_fill_super()? In this case we could process this activity of resources freeing into one place. I mean line 449 in the source code (failure case).

Thanks,
Slava.

> 			res =  -EIO;
> 			goto bail;
> 		}
> -- 
> 2.25.1
> 


  reply	other threads:[~2021-06-29 19:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29 14:48 [PATCH 0/3] hfs: fix various errors Desmond Cheong Zhi Xi
2021-06-29 14:48 ` [PATCH 1/3] hfs: add missing clean-up in hfs_fill_super Desmond Cheong Zhi Xi
2021-06-29 19:13   ` Viacheslav Dubeyko [this message]
2021-06-30  4:50     ` Desmond Cheong Zhi Xi
2021-06-30 16:49       ` Viacheslav Dubeyko
2021-06-29 14:48 ` [PATCH 2/3] hfs: fix high memory mapping in hfs_bnode_read Desmond Cheong Zhi Xi
2021-06-29 19:31   ` Viacheslav Dubeyko
2021-06-30  2:36     ` Desmond Cheong Zhi Xi
2021-06-29 14:48 ` [PATCH 3/3] hfs: add lock nesting notation to hfs_find_init Desmond Cheong Zhi Xi
2021-06-29 19:33   ` Viacheslav Dubeyko

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=28CCF4E3-51D1-43BE-A2BA-4708175A59C0@dubeyko.com \
    --to=slava@dubeyko.com \
    --cc=desmondcheongzx@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [PATCH 1/3] hfs: add missing clean-up in hfs_fill_super' \
    /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

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).