From: Chengguang Xu <cgxu519@mykernel.net>
To: mike.kravetz@oracle.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Chengguang Xu <cgxu519@mykernel.net>
Subject: [PATCH] hugetlbfs: fix error handling in init_hugetlbfs_fs()
Date: Thu, 17 Oct 2019 18:38:22 +0800 [thread overview]
Message-ID: <20191017103822.8610-1-cgxu519@mykernel.net> (raw)
In order to avoid using incorrect mnt, we should set
mnt to NULL when we get error from mount_one_hugetlbfs().
Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
fs/hugetlbfs/inode.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index a478df035651..427d845e7706 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -1470,9 +1470,12 @@ static int __init init_hugetlbfs_fs(void)
i = 0;
for_each_hstate(h) {
mnt = mount_one_hugetlbfs(h);
- if (IS_ERR(mnt) && i == 0) {
- error = PTR_ERR(mnt);
- goto out;
+ if (IS_ERR(mnt)) {
+ if (i == 0) {
+ error = PTR_ERR(mnt);
+ goto out;
+ }
+ mnt = NULL;
}
hugetlbfs_vfsmount[i] = mnt;
i++;
--
2.20.1
next reply other threads:[~2019-10-17 10:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-17 10:38 Chengguang Xu [this message]
2019-10-18 0:08 ` [PATCH] hugetlbfs: fix error handling in init_hugetlbfs_fs() Mike Kravetz
2019-10-18 0:47 ` Mike Kravetz
2019-10-28 21:27 ` Mike Kravetz
2019-10-29 4:36 ` Chengguang Xu
2019-10-29 20:47 ` Mike Kravetz
2019-10-29 22:24 ` Andrew Morton
2019-10-29 22:36 ` Mike Kravetz
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=20191017103822.8610-1-cgxu519@mykernel.net \
--to=cgxu519@mykernel.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.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;
as well as URLs for NNTP newsgroup(s).