From: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
To: gustavoars@kernel.org, viro@zeniv.linux.org.uk
Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
slava@dubeyko.com, skhan@linuxfoundation.org,
gregkh@linuxfoundation.org,
linux-kernel-mentees@lists.linuxfoundation.org
Subject: [PATCH v2 1/3] hfs: add missing clean-up in hfs_fill_super
Date: Thu, 1 Jul 2021 11:07:54 +0800 [thread overview]
Message-ID: <20210701030756.58760-2-desmondcheongzx@gmail.com> (raw)
In-Reply-To: <20210701030756.58760-1-desmondcheongzx@gmail.com>
Before exiting hfs_fill_super, the struct hfs_find_data 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 an error path. We add it
back in by consolidating calls to hfs_find_exit for error paths.
Signed-off-by: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
---
fs/hfs/super.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index 44d07c9e3a7f..12d9bae39363 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -420,14 +420,12 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
if (!res) {
if (fd.entrylength > sizeof(rec) || fd.entrylength < 0) {
res = -EIO;
- goto bail;
+ goto bail_hfs_find;
}
hfs_bnode_read(fd.bnode, &rec, fd.entryoffset, fd.entrylength);
}
- if (res) {
- hfs_find_exit(&fd);
- goto bail_no_root;
- }
+ if (res)
+ goto bail_hfs_find;
res = -EINVAL;
root_inode = hfs_iget(sb, &fd.search_key->cat, &rec);
hfs_find_exit(&fd);
@@ -443,6 +441,8 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
/* everything's okay */
return 0;
+bail_hfs_find:
+ hfs_find_exit(&fd);
bail_no_root:
pr_err("get root inode failed\n");
bail:
--
2.25.1
next prev parent reply other threads:[~2021-07-01 3:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-01 3:07 [PATCH v2 0/3] hfs: fix various errors Desmond Cheong Zhi Xi
2021-07-01 3:07 ` Desmond Cheong Zhi Xi [this message]
2021-07-01 17:03 ` [PATCH v2 1/3] hfs: add missing clean-up in hfs_fill_super Viacheslav Dubeyko
2021-07-01 3:07 ` [PATCH v2 2/3] hfs: fix high memory mapping in hfs_bnode_read Desmond Cheong Zhi Xi
2021-07-01 17:03 ` Viacheslav Dubeyko
2021-07-01 3:07 ` [PATCH v2 3/3] hfs: add lock nesting notation to hfs_find_init Desmond Cheong Zhi Xi
2021-07-01 17:04 ` Viacheslav Dubeyko
2021-07-01 17:03 ` [PATCH v2 0/3] hfs: fix various errors 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=20210701030756.58760-2-desmondcheongzx@gmail.com \
--to=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=slava@dubeyko.com \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®